Re: Reserve device major numbers for pkgsrc

2019-02-18 Thread Michael van Elst
n...@gmx.com (Kamil Rytarowski) writes:

>=46rom end-user point of view major and minor numbers don't matter most o=
>f
>the time (are there exceptions?) and it might be picked by the kernel
>dynamically.

When the kernel choses major numbers dynamically, it must also provide
a dynamically generated mapping to userland.

Minor numbers usually translate 1:1 into device units, they cannot be
chosen dynamically.

End-users are usually concerned with major/minor numbers in that they
don't change (e.g. for find -xdev) and sometimes don't change over
reboots or even re-installations (think about backup).

The most simple method to assign major numbers is to assign them
during installation. Can be as simple as a file in /etc as a registry,
MAKEDEV to create /dev entries and a system call (probably sysctl)
that augments the device switches. Combining the system call with
the module loader is possible, but won't work for autoloaded modules
(not a problem for HAXM).

-- 
-- 
Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: Reserve device major numbers for pkgsrc

2019-02-18 Thread Kamil Rytarowski
On 17.02.2019 21:28, Christoph Badura wrote:
> On Sat, Feb 16, 2019 at 09:02:05PM -0800, John Nemeth wrote:
>> On Feb 16, 11:25pm, Kamil Rytarowski wrote:
>> } Where and how to reserve these major numbers?
>>
>>  The ideal thing is to not reserve numbers at all and have them
>> allocated dynamically.  This requires the module reporting the
>> number that was allocated to userland somehow.  However, the only
>> thing that is coming to mind off the top of my head is printf(9)
>> which would normally land in /var/log/messages.
> 
> We have sysctl as an easy an convenient way.
> 

From end-user point of view major and minor numbers don't matter most of
the time (are there exceptions?) and it might be picked by the kernel
dynamically.

I don't see how printing them in dmesg(8) or exposing to sysctl(2) help.

> Maybe we should think of a standard way to do that there.  E.g. like a
> separate hierarchy for modules and a standard way of naming them.
> 

I'm not sure what does this part mean, but HAXM (and certainly other
users of device nodes) needs them located in exact places (/dev/HAXM etc).

> --chris
> 

devfs is the way to go, but I cannot add this now or short term.

Once we will get devfs functional we can remove restriction of building
the full release as root on NetBSD as this supports generating /dev
entries (mknod(8)). We could drop -U option entirely and need for
privileged builds. (I'm aware that this can be worked around and OS will
try to generate the devices on the first boot).

From the HAXM point of view I will enable support for 64 VMs and until
then I will keep the restriction to 8 VMs in order to reduce the
population of HAX entries in /dev.



signature.asc
Description: OpenPGP digital signature


Re: fallthrough and breaks in drm and atheros codes

2019-02-18 Thread Christos Zoulas
Yes, the order matters. I am not sure why it is different in my build...

christos

> On Feb 18, 2019, at 8:40 PM, Robert Elz  wrote:
> 
>Date:Mon, 18 Feb 2019 19:26:07 -0500
>From:Christos Zoulas 
>Message-ID:  
> 
> 
>  | there is -Wno-error=implicit-fallthrough
> 
> Does the order of the -W flags matter ...
> 
>  | [7:23pm] 2507#make zlib.o
>  | #   compile  GENERIC/zlib.o
>  | gcc -Wno-error=implicit-fallthrough [...] -Werror -Wall  [...]
> 
> kre



Re: fallthrough and breaks in drm and atheros codes

2019-02-18 Thread Robert Elz
Date:Mon, 18 Feb 2019 19:26:07 -0500
From:Christos Zoulas 
Message-ID:  


  | there is -Wno-error=implicit-fallthrough

Does the order of the -W flags matter ...

  | [7:23pm] 2507#make zlib.o
  | #   compile  GENERIC/zlib.o
  | gcc -Wno-error=implicit-fallthrough [...] -Werror -Wall  [...]

kre



re: fallthrough and breaks in drm and atheros codes

2019-02-18 Thread matthew green
> The only different is that my GENERIC has DEBUG and LOCKDEBUG... And as
> you can see from the command line, there is
> -Wno-error=implicit-fallthrough

hmmm..  is this being missed some how?

> cat conf/copts.mk
#   $NetBSD: copts.mk,v 1.3 2019/02/10 05:01:59 mrg Exp $

# MI per-file compiler options required.

.ifndef _SYS_CONF_COPTS_MK_
_SYS_CONF_COPTS_MK_=1

.if defined(HAVE_GCC) && ${HAVE_GCC} == 7 && ${ACTIVE_CC} == "gcc"
COPTS.zlib.c+=  -Wno-error=implicit-fallthrough
COPTS.pf.c+=-Wno-error=implicit-fallthrough
COPTS.radeon_cs.c+= -Wno-error=implicit-fallthrough
COPTS.via_dmablit.c+=   -Wno-error=implicit-fallthrough
.endif

.endif

it's a new file, but should be present for all kernel builds?


.mrg.


Re: fallthrough and breaks in drm and atheros codes

2019-02-18 Thread Christos Zoulas



> On Feb 18, 2019, at 7:20 PM, matthew green  wrote:
> 
>> I am not sure if the following is correct, so I am posting it here instead
>> of committing...
> 
> see my post to source-changes-d -- most of these should
> be ignored for warings already, so i'm curious why you
> had to fix them.
> 
> wrt what is correct, i found several fixes needed by our
> copy of upstream code were already upstream, so it was
> easy to determine what was right for those ones.
> 
> i doubt anyone can really tell you about nouveau fixes
> except upstream.

The only different is that my GENERIC has DEBUG and LOCKDEBUG... And as you can 
see from the command line, there is -Wno-error=implicit-fallthrough

christos


[7:23pm] 2507#make zlib.o
#   compile  GENERIC/zlib.o
gcc -Wno-error=implicit-fallthrough -mcmodel=kernel -mno-red-zone -mno-mmx 
-mno-sse -mno-avx -msoft-float -mindirect-branch=thunk-inline 
-mindirect-branch-register -ffreestanding -fno-zero-initialized-in-bss 
-fno-delete-null-pointer-checks -g -O2 -fno-omit-frame-pointer 
-fstack-protector -Wstack-protector --param ssp-buffer-size=1 
-fno-strict-aliasing -fno-common -Wno-error=implicit-fallthrough -std=gnu99 
-Werror -Wall -Wno-main -Wno-format-zero-length -Wpointer-arith 
-Wmissing-prototypes -Wstrict-prototypes -Wold-style-definition -Wswitch 
-Wshadow -Wcast-qual -Wwrite-strings -Wno-unreachable-code -Wno-pointer-sign 
-Wno-attributes -Wextra -Wno-unused-parameter -Wold-style-definition 
-Wno-sign-compare -Damd64 -Dx86_64 -I. -I../../../../external/bsd/acpica/dist 
-I../../../../external/bsd/libnv/dist -I../../../../../common/lib/libx86emu 
-I../../../../../common/lib/libc/misc -I../../../../../common/include 
-I../../../../arch -I../../../.. -nostdinc -DCOMPAT_UTILS -DDIAGNOSTIC -DDEBUG 
-DCOMPAT_44 -D_KERNEL -D_KERNEL_OPT -std=gnu99 
-I../../../../lib/libkern/../../../common/lib/libc/quad 
-I../../../../lib/libkern/../../../common/lib/libc/string 
-I../../../../lib/libkern/../../../common/lib/libc/arch/x86_64/string 
-D_FORTIFY_SOURCE=2 -I../../../../external/isc/atheros_hal/dist 
-I../../../../external/isc/atheros_hal/ic 
-I../../../../external/bsd/common/include 
-I../../../../external/bsd/common/include 
-I../../../../external/bsd/drm2/include -I../../../../external/bsd/drm2/include 
-I../../../../external/bsd/drm2/include/drm 
-I../../../../external/bsd/common/include 
-I../../../../external/bsd/drm2/dist/include 
-I../../../../external/bsd/drm2/dist/include/drm 
-I../../../../external/bsd/drm2/dist/uapi -I../../../../external/bsd/drm2/dist 
-D__KERNEL__ -DCONFIG_BACKLIGHT_CLASS_DEVICE=0 
-DCONFIG_BACKLIGHT_CLASS_DEVICE_MODULE=0 -DCONFIG_DRM_FBDEV_EMULATION=1 
-DCONFIG_FB=0 -I../../../../../common/include 
-I../../../../external/bsd/libnv/dist -I../../../../external/bsd/drm2/i915drm 
-I../../../../external/bsd/drm2/dist/drm/i915 -DCONFIG_DRM_I915_FBDEV=1 
-DCONFIG_DRM_I915_PRELIMINARY_HW_SUPPORT=0 -DCONFIG_DRM_FBDEV_EMULATION=1 
-I../../../../external/bsd/drm2/include/radeon 
-I../../../../external/bsd/drm2/radeon 
-I../../../../external/bsd/drm2/dist/drm/amd/include 
-I../../../../external/bsd/drm2/dist/drm/radeon 
-I../../../../external/bsd/drm2/dist/drm/nouveau 
-I../../../../external/bsd/drm2/dist/drm/nouveau/include 
-I../../../../external/bsd/drm2/dist/drm/nouveau/include/nvkm 
-I../../../../external/bsd/drm2/dist/drm/nouveau/nvkm 
-I../../../../external/bsd/drm2/nouveau -DCONFIG_NOUVEAU_DEBUG=5 
-DCONFIG_NOUVEAU_DEBUG_DEFAULT=3 -I../../../../external/bsd/acpica/dist/include 
-c ../../../../net/zlib.c -o zlib.o
../../../../net/zlib.c: In function 'inflate':
../../../../net/zlib.c:3531:22: warning: this statement may fall through 
[-Wimplicit-fallthrough=]
   z->state->mode = FLAG;
   ~~~^~



re: fallthrough and breaks in drm and atheros codes

2019-02-18 Thread matthew green
> I am not sure if the following is correct, so I am posting it here instead
> of committing...

see my post to source-changes-d -- most of these should
be ignored for warings already, so i'm curious why you
had to fix them.

wrt what is correct, i found several fixes needed by our
copy of upstream code were already upstream, so it was
easy to determine what was right for those ones.

i doubt anyone can really tell you about nouveau fixes
except upstream.


.mrg.


fallthrough and breaks in drm and atheros codes

2019-02-18 Thread Christos Zoulas


Hi,

I am not sure if the following is correct, so I am posting it here instead
of committing...

christos

Index: 
external/bsd/drm2/dist/drm/nouveau/nvkm/engine/dma/nouveau_nvkm_engine_dma_usernv04.c
===
RCS file: 
/cvsroot/src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/dma/nouveau_nvkm_engine_dma_usernv04.c,v
retrieving revision 1.2
diff -u -p -u -r1.2 nouveau_nvkm_engine_dma_usernv04.c
--- 
external/bsd/drm2/dist/drm/nouveau/nvkm/engine/dma/nouveau_nvkm_engine_dma_usernv04.c
   27 Aug 2018 04:58:31 -  1.2
+++ 
external/bsd/drm2/dist/drm/nouveau/nvkm/engine/dma/nouveau_nvkm_engine_dma_usernv04.c
   18 Feb 2019 23:26:03 -
@@ -127,6 +127,7 @@ nv04_dmaobj_new(struct nvkm_dma *dma, co
break;
case NV_MEM_ACCESS_WO:
dmaobj->flags0 |= 0x8000;
+   break;
case NV_MEM_ACCESS_RW:
dmaobj->flags2 |= 0x0002;
break;
Index: 
external/bsd/drm2/dist/drm/nouveau/nvkm/engine/fifo/nouveau_nvkm_engine_fifo_nv04.c
===
RCS file: 
/cvsroot/src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/fifo/nouveau_nvkm_engine_fifo_nv04.c,v
retrieving revision 1.2
diff -u -p -u -r1.2 nouveau_nvkm_engine_fifo_nv04.c
--- 
external/bsd/drm2/dist/drm/nouveau/nvkm/engine/fifo/nouveau_nvkm_engine_fifo_nv04.c
 27 Aug 2018 04:58:31 -  1.2
+++ 
external/bsd/drm2/dist/drm/nouveau/nvkm/engine/fifo/nouveau_nvkm_engine_fifo_nv04.c
 18 Feb 2019 23:26:03 -
@@ -122,8 +122,10 @@ nv04_fifo_swmthd(struct nvkm_device *dev
switch (mthd) {
case 0x ... 0x: /* subchannel's engine -> software */
nvkm_wr32(device, 0x003280, (engine &= ~mask));
+   /*FALLTHROUGH*/
case 0x0180 ... 0x01fc: /* handle -> instance */
data = nvkm_rd32(device, 0x003258) & 0x;
+   /*FALLTHROUGH*/
case 0x0100 ... 0x017c:
case 0x0200 ... 0x1ffc: /* pass method down to sw */
if (!(engine & mask) && sw)
Index: 
external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/bios/nouveau_nvkm_subdev_bios_perf.c
===
RCS file: 
/cvsroot/src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/bios/nouveau_nvkm_subdev_bios_perf.c,v
retrieving revision 1.2
diff -u -p -u -r1.2 nouveau_nvkm_subdev_bios_perf.c
--- 
external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/bios/nouveau_nvkm_subdev_bios_perf.c
 27 Aug 2018 04:58:33 -  1.2
+++ 
external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/bios/nouveau_nvkm_subdev_bios_perf.c
 18 Feb 2019 23:26:03 -
@@ -139,6 +139,7 @@ nvbios_perfEp(struct nvkm_bios *bios, in
break;
case 0x30:
info->script   = nvbios_rd16(bios, perf + 0x02);
+   break;
case 0x35:
info->fanspeed = nvbios_rd08(bios, perf + 0x06);
info->voltage  = nvbios_rd08(bios, perf + 0x07);
Index: 
external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/bios/nouveau_nvkm_subdev_bios_pll.c
===
RCS file: 
/cvsroot/src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/bios/nouveau_nvkm_subdev_bios_pll.c,v
retrieving revision 1.2
diff -u -p -u -r1.2 nouveau_nvkm_subdev_bios_pll.c
--- 
external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/bios/nouveau_nvkm_subdev_bios_pll.c
  27 Aug 2018 04:58:33 -  1.2
+++ 
external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/bios/nouveau_nvkm_subdev_bios_pll.c
  18 Feb 2019 23:26:03 -
@@ -135,6 +135,7 @@ pll_map(struct nvkm_bios *bios)
device->chipset == 0xaa ||
device->chipset == 0xac)
return g84_pll_mapping;
+   /*FALLTHROUGH*/
default:
return NULL;
}
Index: 
external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/bios/nouveau_nvkm_subdev_bios_timing.c
===
RCS file: 
/cvsroot/src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/bios/nouveau_nvkm_subdev_bios_timing.c,v
retrieving revision 1.2
diff -u -p -u -r1.2 nouveau_nvkm_subdev_bios_timing.c
--- 
external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/bios/nouveau_nvkm_subdev_bios_timing.c
   27 Aug 2018 04:58:33 -  1.2
+++ 
external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/bios/nouveau_nvkm_subdev_bios_timing.c
   18 Feb 2019 23:26:03 -
@@ -120,16 +120,21 @@ nvbios_timingEp(struct nvkm_bios *bios, 
switch (min_t(u8, *hdr, 25)) {
case 25:
p->timing_10_24  = nvbios_rd08(bios, data + 0x18);
+   /*FALLTHROUGH*/
case 24:
case 23:
case 22:
p->timing_10_21  = nvbios_rd08(bios, data + 0x15);
+