<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/nubus/proc.c, branch linux-6.12.y</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=linux-6.12.y</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=linux-6.12.y'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2023-05-22T11:51:56+00:00</updated>
<entry>
<title>nubus: Don't list slot resources by default</title>
<updated>2023-05-22T11:51:56+00:00</updated>
<author>
<name>Finn Thain</name>
<email>fthain@linux-m68k.org</email>
</author>
<published>2023-05-16T01:22:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=72b44f6577f15f37fe964c8dcc42a7c5736e604c'/>
<id>urn:sha1:72b44f6577f15f37fe964c8dcc42a7c5736e604c</id>
<content type='text'>
Some Nubus card ROMs contain many slot resources. A single Radius video
card produced well over a thousand entries under /proc/bus/nubus/.
Populating /proc/bus/nubus/ on a slow machine with several such cards
installed takes long enough that the user may think that the system is
wedged. All those procfs entries also consume significant RAM though
they are not normally needed (except by developers).
Omit these resources from /proc/bus/nubus/ by default and add a kernel
parameter to enable them when needed.
On the test machine, this saved 300 kB and 10 seconds.

Cc: Brad Boyer &lt;flar@allandria.com&gt;
Reviewed-by: Brad Boyer &lt;flar@allandria.com&gt;
Tested-by: Stan Johnson &lt;userm57@yahoo.com&gt;
Signed-off-by: Finn Thain &lt;fthain@linux-m68k.org&gt;
Reviewed-by: Geert Uytterhoeven &lt;geert@linux-m68k.org&gt;
Link: https://lore.kernel.org/r/71ed7fb234a5f7381a50253b0d841a656d53e64c.1684200125.git.fthain@linux-m68k.org
Signed-off-by: Geert Uytterhoeven &lt;geert@linux-m68k.org&gt;
</content>
</entry>
<entry>
<title>nubus: Remove proc entries before adding them</title>
<updated>2023-05-22T11:51:48+00:00</updated>
<author>
<name>Finn Thain</name>
<email>fthain@linux-m68k.org</email>
</author>
<published>2023-03-22T00:54:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b7629ce6f492eb2d48b9ee1dab5980c7278514c1'/>
<id>urn:sha1:b7629ce6f492eb2d48b9ee1dab5980c7278514c1</id>
<content type='text'>
The config ROMs on some Nubus cards contain mistakes such as resource
duplication. This results in a warning from proc_register():

    NuBus: Scanning NuBus slots.
    ------------[ cut here ]------------
    WARNING: CPU: 0 PID: 1 at fs/proc/generic.c:376 proc_register+0xbc/0xda
    proc_dir_entry '24/5' already registered
    Modules linked in:
    CPU: 0 PID: 1 Comm: swapper Not tainted 6.1.0-5-m68k #1  Debian 6.1.12-1
    Stack from 00829d18:
            00829d18 00451507 00451507 00000000 00000009 0038c57c 00451507 00386bae
            00442945 0045f062 00000178 00868580 00868f50 00386c42 0045f062 00000178
            00166fc8 00000009 00000000 00829d78 008685e4 0037f9ec 00000025 00248808
            0045f0df 00829d94 00166fc8 0045f062 00000178 00000009 0045f0df 008689e4
            008685e4 fafe3a20 00868980 00829df3 00829e32 00000024 00829dc0 00167332
            00868980 00868580 00829e40 00248d36 00829df3 00008124 00868980 00248b0c
    Call Trace: [&lt;0038c57c&gt;] dump_stack+0xc/0x10
     [&lt;00386bae&gt;] __warn+0x70/0xbc
     [&lt;00386c42&gt;] warn_slowpath_fmt+0x48/0x66
     [&lt;00166fc8&gt;] proc_register+0xbc/0xda
     [&lt;0037f9ec&gt;] memcmp+0x0/0x56
     [&lt;00248808&gt;] nubus_get_rsrc_str+0x0/0x5e
     [&lt;00166fc8&gt;] proc_register+0xbc/0xda
     [&lt;00167332&gt;] proc_create_single_data+0x40/0x48
     [&lt;00248d36&gt;] nubus_proc_add_rsrc_mem+0x68/0xa4
     [&lt;00008124&gt;] amiga_mksound+0xb8/0xc8
     [&lt;00248b0c&gt;] nubus_proc_rsrc_show+0x0/0xa4
     [&lt;00386180&gt;] memset+0x0/0x94
     [&lt;0024864a&gt;] nubus_readdir+0x0/0x66
     [&lt;00560f35&gt;] nubus_get_vendorinfo.isra.0+0x87/0x10e
     [&lt;00560fb4&gt;] nubus_get_vendorinfo.isra.0+0x106/0x10e
     [&lt;00248d72&gt;] nubus_proc_add_rsrc+0x0/0x8e
     [&lt;001f6f50&gt;] __dynamic_pr_debug+0x0/0x96
     [&lt;0038741e&gt;] _printk+0x0/0x18
     [&lt;0016fafe&gt;] kernfs_link_sibling+0x9a/0xaa
     [&lt;00561cb0&gt;] nubus_init+0x660/0x79c
     [&lt;0037f7c6&gt;] strcpy+0x0/0x1c
     [&lt;0003f58c&gt;] parse_args+0x0/0x308
     [&lt;00002104&gt;] do_one_initcall+0x0/0x184
     [&lt;00561650&gt;] nubus_init+0x0/0x79c
     [&lt;00010000&gt;] frc1_dst+0xe/0x14
     [&lt;00002172&gt;] do_one_initcall+0x6e/0x184
     [&lt;0037f7c6&gt;] strcpy+0x0/0x1c
     [&lt;0003f58c&gt;] parse_args+0x0/0x308
     [&lt;00002104&gt;] do_one_initcall+0x0/0x184
     [&lt;0054b25c&gt;] kernel_init_freeable+0x192/0x19c
     [&lt;00561650&gt;] nubus_init+0x0/0x79c
     [&lt;0038c6c4&gt;] kernel_init+0x0/0xec
     [&lt;0038c6d8&gt;] kernel_init+0x14/0xec
     [&lt;0038c6c4&gt;] kernel_init+0x0/0xec
     [&lt;0000297c&gt;] ret_from_kernel_thread+0xc/0x14

    ---[ end trace 0000000000000000 ]---

This particular card (a Radius video card) contains a duplicated resource
hence the /proc/bus/nubus/a/1/24/5 entry got registered twice.
(A date resource has ID 5, the vendor info directory has ID 24)

The solution for this is to remove a potentially pre-existing entry before
adding the procfs entry for the resource.

Reported-and-tested-by: Stan Johnson &lt;userm57@yahoo.com&gt;
Signed-off-by: Finn Thain &lt;fthain@linux-m68k.org&gt;
Reviewed-by: Geert Uytterhoeven &lt;geert@linux-m68k.org&gt;
Link: https://lore.kernel.org/r/dd1b560bbe426b351cdbb3bbf89414753c3d0117.1679446472.git.fthain@linux-m68k.org
Signed-off-by: Geert Uytterhoeven &lt;geert@linux-m68k.org&gt;
</content>
</entry>
<entry>
<title>nubus: Partially revert proc_create_single_data() conversion</title>
<updated>2023-05-22T11:51:47+00:00</updated>
<author>
<name>Finn Thain</name>
<email>fthain@linux-m68k.org</email>
</author>
<published>2023-03-14T08:51:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=0e96647cff9224db564a1cee6efccb13dbe11ee2'/>
<id>urn:sha1:0e96647cff9224db564a1cee6efccb13dbe11ee2</id>
<content type='text'>
The conversion to proc_create_single_data() introduced a regression
whereby reading a file in /proc/bus/nubus results in a seg fault:

    # grep -r . /proc/bus/nubus/e/
    Data read fault at 0x00000020 in Super Data (pc=0x1074c2)
    BAD KERNEL BUSERR
    Oops: 00000000
    Modules linked in:
    PC: [&lt;001074c2&gt;] PDE_DATA+0xc/0x16
    SR: 2010  SP: 38284958  a2: 01152370
    d0: 00000001    d1: 01013000    d2: 01002790    d3: 00000000
    d4: 00000001    d5: 0008ce2e    a0: 00000000    a1: 00222a40
    Process grep (pid: 45, task=142f8727)
    Frame format=B ssw=074d isc=2008 isb=4e5e daddr=00000020 dobuf=01199e70
    baddr=001074c8 dibuf=ffffffff ver=f
    Stack from 01199e48:
	    01199e70 00222a58 01002790 00000000 011a3000 01199eb0 015000c0 00000000
	    00000000 01199ec0 01199ec0 000d551a 011a3000 00000001 00000000 00018000
	    d003f000 00000003 00000001 0002800d 01052840 01199fa8 c01f8000 00000000
	    00000029 0b532b80 00000000 00000000 00000029 0b532b80 01199ee4 00103640
	    011198c0 d003f000 00018000 01199fa8 00000000 011198c0 00000000 01199f4c
	    000b3344 011198c0 d003f000 00018000 01199fa8 00000000 00018000 011198c0
    Call Trace: [&lt;00222a58&gt;] nubus_proc_rsrc_show+0x18/0xa0
     [&lt;000d551a&gt;] seq_read+0xc4/0x510
     [&lt;00018000&gt;] fp_fcos+0x2/0x82
     [&lt;0002800d&gt;] __sys_setreuid+0x115/0x1c6
     [&lt;00103640&gt;] proc_reg_read+0x5c/0xb0
     [&lt;00018000&gt;] fp_fcos+0x2/0x82
     [&lt;000b3344&gt;] __vfs_read+0x2c/0x13c
     [&lt;00018000&gt;] fp_fcos+0x2/0x82
     [&lt;00018000&gt;] fp_fcos+0x2/0x82
     [&lt;000b8aa2&gt;] sys_statx+0x60/0x7e
     [&lt;000b34b6&gt;] vfs_read+0x62/0x12a
     [&lt;00018000&gt;] fp_fcos+0x2/0x82
     [&lt;00018000&gt;] fp_fcos+0x2/0x82
     [&lt;000b39c2&gt;] ksys_read+0x48/0xbe
     [&lt;00018000&gt;] fp_fcos+0x2/0x82
     [&lt;000b3a4e&gt;] sys_read+0x16/0x1a
     [&lt;00018000&gt;] fp_fcos+0x2/0x82
     [&lt;00002b84&gt;] syscall+0x8/0xc
     [&lt;00018000&gt;] fp_fcos+0x2/0x82
     [&lt;0000c016&gt;] not_ext+0xa/0x18
    Code: 4e5e 4e75 4e56 0000 206e 0008 2068 ffe8 &lt;2068&gt; 0020 2008 4e5e 4e75 4e56 0000 2f0b 206e 0008 2068 0004 2668 0020 206b ffe8
    Disabling lock debugging due to kernel taint

    Segmentation fault

The proc_create_single_data() conversion does not work because
single_open(file, nubus_proc_rsrc_show, PDE_DATA(inode)) is not
equivalent to the original code.

Fixes: 3f3942aca6da ("proc: introduce proc_create_single{,_data}")
Cc: Christoph Hellwig &lt;hch@lst.de&gt;
Cc: stable@vger.kernel.org # 5.6+
Signed-off-by: Finn Thain &lt;fthain@linux-m68k.org&gt;
Reviewed-by: Geert Uytterhoeven &lt;geert@linux-m68k.org&gt;
Link: https://lore.kernel.org/r/d4e2a586e793cc8d9442595684ab8a077c0fe726.1678783919.git.fthain@linux-m68k.org
Signed-off-by: Geert Uytterhoeven &lt;geert@linux-m68k.org&gt;
</content>
</entry>
<entry>
<title>proc: remove PDE_DATA() completely</title>
<updated>2022-01-22T06:33:37+00:00</updated>
<author>
<name>Muchun Song</name>
<email>songmuchun@bytedance.com</email>
</author>
<published>2022-01-22T06:14:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=359745d78351c6f5442435f81549f0207ece28aa'/>
<id>urn:sha1:359745d78351c6f5442435f81549f0207ece28aa</id>
<content type='text'>
Remove PDE_DATA() completely and replace it with pde_data().

[akpm@linux-foundation.org: fix naming clash in drivers/nubus/proc.c]
[akpm@linux-foundation.org: now fix it properly]

Link: https://lkml.kernel.org/r/20211124081956.87711-2-songmuchun@bytedance.com
Signed-off-by: Muchun Song &lt;songmuchun@bytedance.com&gt;
Acked-by: Christian Brauner &lt;christian.brauner@ubuntu.com&gt;
Cc: Alexey Dobriyan &lt;adobriyan@gmail.com&gt;
Cc: Alexey Gladkov &lt;gladkov.alexey@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>proc: introduce proc_create_single{,_data}</title>
<updated>2018-05-16T05:23:35+00:00</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2018-05-15T13:57:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3f3942aca6da351a12543aa776467791b63b3a78'/>
<id>urn:sha1:3f3942aca6da351a12543aa776467791b63b3a78</id>
<content type='text'>
Variants of proc_create{,_data} that directly take a seq_file show
callback and drastically reduces the boilerplate code in the callers.

All trivial callers converted over.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
</content>
</entry>
<entry>
<title>nubus: Add support for the driver model</title>
<updated>2018-01-16T15:47:29+00:00</updated>
<author>
<name>Finn Thain</name>
<email>fthain@telegraphics.com.au</email>
</author>
<published>2018-01-13T22:37:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7f86c765a6a2bb837c45f11526176125ff50e21f'/>
<id>urn:sha1:7f86c765a6a2bb837c45f11526176125ff50e21f</id>
<content type='text'>
This patch brings basic support for the Linux Driver Model to the
NuBus subsystem.

For flexibility, the matching of boards with drivers is left up to the
drivers. This is also the approach taken by NetBSD. A board may have
many functions, and drivers may have to consider many functional
resources and board resources in order to match a device.

This implementation does not bind drivers to resources (nor does it bind
many drivers to the same board). Apple's NuBus declaration ROM design
is flexible enough to allow that, but I don't see a need to support it
as we don't use the "slot zero" resources (in the main logic board ROM).

Eliminate the global nubus_boards linked list by rewriting the procfs
board iterator around bus_for_each_dev(). Hence the nubus device refcount
can be used to determine the lifespan of board objects.

Cc: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Reviewed-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Tested-by: Stan Johnson &lt;userm57@yahoo.com&gt;
Signed-off-by: Finn Thain &lt;fthain@telegraphics.com.au&gt;
Signed-off-by: Geert Uytterhoeven &lt;geert@linux-m68k.org&gt;
</content>
</entry>
<entry>
<title>nubus: Adopt standard linked list implementation</title>
<updated>2018-01-16T15:47:29+00:00</updated>
<author>
<name>Finn Thain</name>
<email>fthain@telegraphics.com.au</email>
</author>
<published>2018-01-13T22:37:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=41b848160eabb22957652936b66ccafd95ab5ad8'/>
<id>urn:sha1:41b848160eabb22957652936b66ccafd95ab5ad8</id>
<content type='text'>
This increases code re-use and improves readability.

Cc: "David S. Miller" &lt;davem@davemloft.net&gt;
Cc: Bartlomiej Zolnierkiewicz &lt;b.zolnierkie@samsung.com&gt;
Acked-by: Bartlomiej Zolnierkiewicz &lt;b.zolnierkie@samsung.com&gt;
Tested-by: Stan Johnson &lt;userm57@yahoo.com&gt;
Signed-off-by: Finn Thain &lt;fthain@telegraphics.com.au&gt;
Signed-off-by: Geert Uytterhoeven &lt;geert@linux-m68k.org&gt;
</content>
</entry>
<entry>
<title>nubus: Rename struct nubus_dev</title>
<updated>2018-01-16T15:47:29+00:00</updated>
<author>
<name>Finn Thain</name>
<email>fthain@telegraphics.com.au</email>
</author>
<published>2018-01-13T22:37:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=189e19e8cbb49f5bf483e55bdbd1e56d3d6bcf75'/>
<id>urn:sha1:189e19e8cbb49f5bf483e55bdbd1e56d3d6bcf75</id>
<content type='text'>
It is misleading to call a functional resource a "device". In adopting
the Linux Driver Model, the struct device will be embedded in struct
nubus_board. That will compound the terminlogy problem because drivers
will bind with boards, not with functional resources. Avoid this by
renaming struct nubus_dev as struct nubus_rsrc. "Functional resource"
is the vendor's terminology so this helps avoid confusion.

Cc: "David S. Miller" &lt;davem@davemloft.net&gt;
Cc: Bartlomiej Zolnierkiewicz &lt;b.zolnierkie@samsung.com&gt;
Acked-by: Bartlomiej Zolnierkiewicz &lt;b.zolnierkie@samsung.com&gt;
Tested-by: Stan Johnson &lt;userm57@yahoo.com&gt;
Signed-off-by: Finn Thain &lt;fthain@telegraphics.com.au&gt;
Signed-off-by: Geert Uytterhoeven &lt;geert@linux-m68k.org&gt;
</content>
</entry>
<entry>
<title>nubus: Rework /proc/bus/nubus/s/ implementation</title>
<updated>2018-01-16T15:47:29+00:00</updated>
<author>
<name>Finn Thain</name>
<email>fthain@telegraphics.com.au</email>
</author>
<published>2018-01-13T22:37:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2f7dd07ecadac6bdc3d55c217d65efa2834ba1cb'/>
<id>urn:sha1:2f7dd07ecadac6bdc3d55c217d65efa2834ba1cb</id>
<content type='text'>
The /proc/bus/nubus/s/ directory tree for any slot s is missing a lot
of information. The struct file_operations methods have long been left
unimplemented (hence the familiar compile-time warning, "Need to set
some I/O handlers here").

Slot resources have a complex structure which varies depending on board
function. The logic for interpreting these ROM data structures is found
in nubus.c. Let's not duplicate that logic in proc.c.

Create the /proc/bus/nubus/s/ inodes while scanning slot s. During
descent through slot resource subdirectories, call the new
nubus_proc_add_foo() functions to create the procfs inodes.

Also add a new function, nubus_seq_write_rsrc_mem(), to write the
contents of a particular slot resource to a given seq_file. This is
used by the procfs file_operations methods, to finally give userspace
access to slot ROM information, such as the available video modes.

Tested-by: Stan Johnson &lt;userm57@yahoo.com&gt;
Signed-off-by: Finn Thain &lt;fthain@telegraphics.com.au&gt;
Signed-off-by: Geert Uytterhoeven &lt;geert@linux-m68k.org&gt;
</content>
</entry>
<entry>
<title>nubus: Remove redundant code</title>
<updated>2018-01-16T15:47:29+00:00</updated>
<author>
<name>Finn Thain</name>
<email>fthain@telegraphics.com.au</email>
</author>
<published>2018-01-13T22:37:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=9f97977deb22e602f91047a105b961ffb36adc2b'/>
<id>urn:sha1:9f97977deb22e602f91047a105b961ffb36adc2b</id>
<content type='text'>
Eliminate unused values from struct nubus_dev to save wasted memory
(a Radius PrecisionColor 24X card has about 95 functional resources
and up to six such cards may be fitted). Also remove redundant static
variable initialization, an unreachable !MACH_IS_MAC conditional,
the unused nubus_find_device() function, the bogus get_nubus_list()
prototype and the pointless card_present temporary variable.

Tested-by: Stan Johnson &lt;userm57@yahoo.com&gt;
Signed-off-by: Finn Thain &lt;fthain@telegraphics.com.au&gt;
Signed-off-by: Geert Uytterhoeven &lt;geert@linux-m68k.org&gt;
</content>
</entry>
</feed>
