Page MenuHomeFreeBSD

mmel (Michal Meloun)
User

Projects

User Details

User Since
Feb 3 2015, 4:54 AM (557 w, 4 d)

Recent Activity

Tue, Sep 30

mmel accepted D52783: gpioc: fix race in ioctl(GPIOCONFIGEVENTS).
Tue, Sep 30, 10:13 AM
mmel added inline comments to D52783: gpioc: fix race in ioctl(GPIOCONFIGEVENTS).
Tue, Sep 30, 7:52 AM
mmel added inline comments to D52783: gpioc: fix race in ioctl(GPIOCONFIGEVENTS).
Tue, Sep 30, 7:23 AM
mmel added inline comments to D52783: gpioc: fix race in ioctl(GPIOCONFIGEVENTS).
Tue, Sep 30, 6:43 AM

Wed, Sep 17

mmel accepted D52309: rk_tsadc: use tsadc_temp_to_raw for shutdown_temp.

I apologize, I forgot about that. I thought I had already completed all phabricator tasks.

Wed, Sep 17, 10:05 AM

Aug 29 2025

mmel added a comment to D52197: gpio: implement bus_setup_intr and bus_teardown_intr.

These are needed for cross-tree allocation of interrupts (and probably also pins). For example, in FDT, a device from another tree path, typically an I2C or SPI, may have its IRQ pin connected to GPIO.
A driver from another tree path can therefore use an GPIO based interrupt. These allocations are processed by the controller itself (due to FDT references), but by gpiobus.
@andrew is right, at least (de)activate_resource is necessary, but I'm not sure yet whether other resource list oriented methods are also needed.

Aug 29 2025, 7:28 AM

Aug 28 2025

mmel added a comment to D52197: gpio: implement bus_setup_intr and bus_teardown_intr.

I just found a similar problem with rockchip gpio. Implementing interrupt methods is not enough, we also need all the methods for resources. This led me to the idea that we could create a new class in which all these methods (interrupts and resources) would be implemented (by using bus_generic_<foo>), and then subclass all bus-like drivers from it. It's clean, simple, and saves a lot of lines...
@jhb, do you have any comments on this?

Aug 28 2025, 8:00 AM

Aug 27 2025

mmel accepted D51932: gpio: make gpioc a child of gpiobus.
Aug 27 2025, 4:47 AM
mmel accepted D52172: gpio: add GPIO_GET_PIN_LIST.
Aug 27 2025, 4:27 AM

Aug 26 2025

mmel added a comment to D51932: gpio: make gpioc a child of gpiobus.

We can introduce a new method, such as

METHOD  get_pin_list{
 device_t dev;
 device_t bus;
 uint32_t *pin_list;
};

which fills a pre-allocated array with the controller pin numbers, with a default implementation based on GPIO_PIN_MAX() (assuming it returns the number of controller pins - 1) and sequential numbering starting with pin number 0.
This way, we can obtain a list of pins for all 'standard' controllers without any changes to their code, but we retain the option to modify it for 'more creative' ones.

Consider this only as a first quick attempt to solve this puzzle.

That sounds good :)
Although I don't see why we would need the gpiobus dev.

Right, it's not necessary. Please ignore it.

Aug 26 2025, 4:33 PM
mmel accepted D51931: gpiobus: add pin_config_32 and pin_access_32.
Aug 26 2025, 4:08 PM

Aug 25 2025

mmel added a comment to D51932: gpio: make gpioc a child of gpiobus.

We can introduce a new method, such as

METHOD  get_pin_list{
 device_t dev;
 device_t bus;
 uint32_t *pin_list;
};

which fills a pre-allocated array with the controller pin numbers, with a default implementation based on GPIO_PIN_MAX() (assuming it returns the number of controller pins - 1) and sequential numbering starting with pin number 0.
This way, we can obtain a list of pins for all 'standard' controllers without any changes to their code, but we retain the option to modify it for 'more creative' ones.

Aug 25 2025, 6:40 AM
mmel added a comment to D51931: gpiobus: add pin_config_32 and pin_access_32.

That seems fine to me. Unfortunately, I just found that config32 has num_pins as an argument, so it may not work on all 32 bits :( I didn't notice that before, sorry.

Aug 25 2025, 6:17 AM

Aug 21 2025

mmel added a comment to D51931: gpiobus: add pin_config_32 and pin_access_32.

Gpiobus should convert these virtual pin numbers to real ones (gpio controller) using IVARS and can assume absolutely nothing about the ordering/sequencing of these translated numbers.

Yeah I missed the ordering part, like the other review. I guess that means we can't check if they're all in the ivars before passing the call to the controller. All we can do in that case is make sure that devi->npins >= 32?

IMHO no, we should check if they are all in ivars, sequentially, starting with first_pin. See later.

The controller (i.e. using gpio ifc) access_32/configure_32 expects to work on 32/npins consecutive pin numbers. This means that the corresponding gpiobus methods must only work on slaves with 32/npins or more consecutive pin mappings.

Aug 21 2025, 3:04 PM
mmel added inline comments to D51932: gpio: make gpioc a child of gpiobus.
Aug 21 2025, 2:29 PM
mmel added inline comments to D51932: gpio: make gpioc a child of gpiobus.
Aug 21 2025, 10:21 AM
mmel added a comment to D51931: gpiobus: add pin_config_32 and pin_access_32.

Sorry, but this is making less and less sense to me.

Aug 21 2025, 9:56 AM
mmel added a comment to D47919: Add StarFive JH7110's PCIE controller driver.

Theoretically, every interrupt controller should implement all 3 of these functions.

Aug 21 2025, 8:31 AM

Aug 20 2025

mmel accepted D51931: gpiobus: add pin_config_32 and pin_access_32.

Oups, my bad. I didn't realize that these are exposed by the ioct().
Only, Could you please check if the entire pin range
is within bound?

Aug 20 2025, 7:38 AM

Aug 18 2025

mmel added a comment to D51932: gpio: make gpioc a child of gpiobus.

I like this step. But please give me one more day to re-analyze it.

Aug 18 2025, 6:36 AM
mmel added a comment to D51931: gpiobus: add pin_config_32 and pin_access_32.

pin_config_32 doesn't make sense to me at the moment. Ian created it at a time when we could only configure the direction of pins and only for specific hardware (if I remember correctly, iMX51). Now there is no chance that it could be implemented for current hardware and pin flags. Configuration settings are almost never atomic for a single pin, let alone for multiple pins.

Aug 18 2025, 6:27 AM

Aug 11 2025

mmel accepted D51578: gpio: remove gpiobus_attach_bus.

Thanks for patience, I know how much frustrating can be these change requests based on "subjective" nuances .

Aug 11 2025, 5:43 AM

Aug 10 2025

mmel added a comment to D51578: gpio: remove gpiobus_attach_bus.

I apologize. I should not write reviews when I am short on time.
I wanted to say that I fully agree with jhb. The gpiobus_attach_bus() function is too limited to be generally useful.
That is why I vote to replace it with the gpiobus_add_bus() function and explicit bus_attach_children().

Aug 10 2025, 6:31 AM

Aug 8 2025

mmel added a comment to D51578: gpio: remove gpiobus_attach_bus.

Sorry for the delayed response, I've very busy in real life again.

Aug 8 2025, 5:56 AM

Aug 7 2025

mmel committed rGe4bfe8e96615: arm: Generate the kernel.bin file in zImage format. (authored by mmel).
arm: Generate the kernel.bin file in zImage format.
Aug 7 2025, 4:45 PM

Jul 28 2025

mmel added a comment to D51456: Add support for bcm2835-virtgpio GPIO controller on some RPi models..

Unfortunately, changing the memory to uncacheable does not ensure cache coherence. Both parties(firmware and kernel) must have the memory mapped with the same attribute, otherwise undefined behavior will occur.
Please also note that the current implementation of the pmap_change_attr() does not allow its use on memory pages that are mapped multiple times (such DMAP and kernel).

Jul 28 2025, 6:51 AM

Jul 16 2025

mmel added a comment to D51330: subr_intr: Support per-CPU IPI vectors.

but why can't the PIC expose a single isrc that internally happens to send multiple interrupts as far as the hardware is concerned?

Jul 16 2025, 6:51 AM

Jul 3 2025

mmel accepted D50369: riscv: enable allwinner RTC.

LGTM

Jul 3 2025, 7:07 AM
mmel accepted D51088: gpio: attach gpiobus when the controller is ready.

Thank you very much for your patience. Please don't forget the MFC for this whole series.

Jul 3 2025, 7:06 AM
mmel accepted D51108: gpio: remove redundant calls to bus_attach_children.
Jul 3 2025, 7:02 AM
mmel accepted D51133: gpiobus: add a gpiobus_add_bus function.
Jul 3 2025, 7:01 AM

Jul 2 2025

mmel added a comment to D51088: gpio: attach gpiobus when the controller is ready.

max77620 and as3722 are much more problematic. I think each function expects the other functions to have HW initialized before they can be consumed.

Jul 2 2025, 12:02 PM
mmel accepted D51108: gpio: remove redundant calls to bus_attach_children.

Strictly speaking, they are not entirely useless. A multi-function device can expose multiple different buses, so it can add another child when gpiobus_attach_bus() is called. In an ideal world, we should have an explicit bus_attach_children() function at the end of each respective driver (especially if it exposes multiple functions).
However, this is only a theoretical notice , nothing more.

Jul 2 2025, 11:20 AM

Jul 1 2025

mmel requested changes to D51088: gpio: attach gpiobus when the controller is ready.

One commit for moving gpiobus_attach_bus() after init (seems fine to me)
and another for changes to pl061 (the ACPI/WDT interrupt changes seems unrelated).
Removing bus_attach_children() is questionable ( and probably wrong)
and moving bus_setup_intr() before HW init is clearly wrong.

Jul 1 2025, 12:42 PM

Jun 19 2025

mmel accepted D50940: gpiobus: gpiobus_acquire_pin: panic on invalid pin.
Jun 19 2025, 2:38 PM
mmel accepted D50868: gpiobus: gpio_pin_release: convert checks to KASSERTs.

Thanks.

Jun 19 2025, 2:37 PM
mmel added a comment to D50868: gpiobus: gpio_pin_release: convert checks to KASSERTs.

Motivation? Why do we need gpio_pin_release to return errors?

It was to have it in line with gpio_pin_acquire. I found it a little weird that only one of them would report errors.

All *release* functions are usually very difficult to recover, especially if they are called throw multiple layers.

This creates the problem of freeing the gpio structure in case of an error.

At first I was freeing on both failure and success, but I wasn't sure that was the right thing to do..

This leading to a situation where the malloc cannot be released in any way. If gpiobus_release_pin() fails once, then it will always fail. But this is irrelevant if we replace errors with panic...

IMHO, I think all errors in gpiobus_release_pin() and gpiobus_acquire_pin() should be converted to panic().
Also passing NULL to gpio_pin_release() should be panic().

I agree for gpiobus_release_pin, since they're all programming errors. For gpiobus_acquire_pin, I think attempting to acquire a pin twice should just return an error to the caller, it's possible the caller can just recover.

Jun 19 2025, 9:16 AM
mmel added a comment to D50868: gpiobus: gpio_pin_release: convert checks to KASSERTs.

Motivation? Why do we need gpio_pin_release to return errors?
This creates the problem of freeing the gpio structure in case of an error.
IMHO, I think all errors in gpiobus_release_pin() and gpiobus_acquire_pin() should be converted to panic().
Also passing NULL to gpio_pin_release() should be panic().

Jun 19 2025, 7:51 AM

Jun 17 2025

mmel accepted D50870: regulator: don't use internal gpiobus function.

Thanks.
The most problematic variant is GPIO over I2C bus (or other serial bus), where sleepable(SX) locks are required for basic operation. So I just was to be very careful and warn others of the problematic place.

Jun 17 2025, 6:21 PM
mmel accepted D50869: gpiobus: add gpio_pin_acquire.
Jun 17 2025, 5:57 PM
mmel added a comment to D50870: regulator: don't use internal gpiobus function.

Why did you remove the comment? IMHO it is still a bit problematic (or not well defined) to hold the mutex across the GPIO infrastructure call.

Jun 17 2025, 1:25 PM
mmel requested changes to D50869: gpiobus: add gpio_pin_acquire.

Otherwise, it looks fine to me.

Jun 17 2025, 1:14 PM

May 14 2025

mmel accepted D50309: subr_devmap: Implement pmap_mapdev with pmap_mapdev_attr.

Thanks

May 14 2025, 6:26 PM
mmel added inline comments to D50309: subr_devmap: Implement pmap_mapdev with pmap_mapdev_attr.
May 14 2025, 11:52 AM

May 12 2025

mmel added a comment to D50307: arm: Make the pmap_kenter signature like arm64.

I'm sorry, I wanted to send it to D50309.

May 12 2025, 8:14 PM
mmel added a comment to D50307: arm: Make the pmap_kenter signature like arm64.

Very briefly, I think this clashes with devmap_add_entry(), which is used on armv7 to reduce the TLB load. The pmap_mapdev_attr() function does not respect the required attributes for pages previously mapped by devmap_add_entry(). Imho, we don't have a method for changing page attributes on multiple mapped pages in an architecturally correct way. (And I'm afraid this is true for arm64 , for pages mapped by DMAP and also in some other way).

May 12 2025, 8:09 PM

May 4 2025

mmel committed rGec5083a0e890: rk_iodomain: Do not require optional FDT properties. (authored by mmel).
rk_iodomain: Do not require optional FDT properties.
May 4 2025, 5:10 PM
mmel committed rG50fda38ba0b0: libgcc_s: export integer and floating point __aeabi_ symbols (authored by mmel).
libgcc_s: export integer and floating point __aeabi_ symbols
May 4 2025, 5:10 PM
mmel committed rG71279c158005: rk3568 pcie: Do not require optional FDT properties. (authored by mmel).
rk3568 pcie: Do not require optional FDT properties.
May 4 2025, 5:10 PM
mmel closed D50101: rk_iodomain: Do not require optional FDT properties.
May 4 2025, 5:10 PM
mmel committed rG9ee759f3676f: Decorate IPv4 structures used for byte buffer overlays as packed. (authored by mmel).
Decorate IPv4 structures used for byte buffer overlays as packed.
May 4 2025, 5:10 PM
mmel closed D50100: libgcc_s: export integer and floating point __aeabi_ symbols .
May 4 2025, 5:10 PM
mmel closed D50102: rk3568 pcie: Do not require optional FDT properties..
May 4 2025, 5:10 PM
mmel closed D50103: netinet: Decorate IPv4 structures used for byte buffer overlays as packed..
May 4 2025, 5:10 PM
mmel added a comment to D50100: libgcc_s: export integer and floating point __aeabi_ symbols .

I plan to MFC it, sure. I just forgot to copy all tag lines into the review.

May 4 2025, 11:10 AM

May 3 2025

mmel committed rGbec5167645b5: arm: Improve the creation of kernel.bin (authored by mmel).
arm: Improve the creation of kernel.bin
May 3 2025, 10:09 AM
mmel committed rG0aca1d4e7c76: arm: remove accidentally added -Map switch to linker (authored by mmel).
arm: remove accidentally added -Map switch to linker
May 3 2025, 10:09 AM

May 1 2025

mmel added a comment to D50103: netinet: Decorate IPv4 structures used for byte buffer overlays as packed..

I disagree, __packed resets the alignment to 1, so __attribute__((aligned(x))) can increase it. Imho, internally, __packed does nothing but reset the alignment of all members to 1 . Everything else (padding, size) is derived from that.
see: https://developer.arm.com/documentation/dui0472/m/Compiler-specific-Features/--attribute----packed---variable-attribute

May 1 2025, 11:20 AM
mmel added a comment to D50100: libgcc_s: export integer and floating point __aeabi_ symbols .

They are all softfloat - all aeabi functions use softfloat calling convections and compiler-rt implementation doesn't use VFP. I removed the optimized VFP variants from the build (because they needed support in the RT linker). Imho these floating point functions are only used for softfloat binaries and also for Thumb-1 code.

May 1 2025, 10:43 AM
mmel added a comment to D50103: netinet: Decorate IPv4 structures used for byte buffer overlays as packed..

I think that __packed attribute also forces the object to be aligned to 1, so it begins conform with the C language rules. I think this is the only way to reduce the alignment of an object -> __attribute__((packed, aligned(x)))

May 1 2025, 9:40 AM
mmel requested review of D50103: netinet: Decorate IPv4 structures used for byte buffer overlays as packed..
May 1 2025, 9:08 AM
mmel requested review of D50102: rk3568 pcie: Do not require optional FDT properties..
May 1 2025, 8:49 AM
mmel requested review of D50101: rk_iodomain: Do not require optional FDT properties.
May 1 2025, 8:44 AM
mmel requested review of D50100: libgcc_s: export integer and floating point __aeabi_ symbols .
May 1 2025, 8:27 AM
mmel accepted D50083: Make sure the memory region definitions are zeroed before use..

imho, using two temporary ulong variables for function calls and assigning them to mem_region members gives the compiler a chance to complain. But both versions are OK for me.
And my apology for not committed this fix in time...
Michal

May 1 2025, 7:19 AM

Apr 3 2025

mmel added a comment to D49655: kern: add an extres-style power domain framework.

How will multiple devices inside a single power domain be handled?

Apr 3 2025, 4:36 PM
mmel added a comment to D49655: kern: add an extres-style power domain framework.

I really didn't want to force you to revert it. And it's just my problem that I didn't notice it at the right time. I just wanted to pass on this (perhaps obvious) information to someone else who is less sclerotic than me, that's all. Mostly because I've been super lazy lately, so no one can expect anything from me that just a few words.

Apr 3 2025, 4:30 PM
mmel accepted D49655: kern: add an extres-style power domain framework.

LGTM. Just note that the newly added OF_device_unregister_xref() function does not work as expected without some sort of reference couting. A single device can (and do it in many cases) provide multiple functions (for example - pinmux, gpio, and interrupt controller), so is registered using respective frameworks 3x...

Apr 3 2025, 2:40 PM

Mar 12 2025

mmel added inline comments to D49265: arm: Use the counter in the early arm64 DELAY.
Mar 12 2025, 5:39 PM
mmel added inline comments to D49265: arm: Use the counter in the early arm64 DELAY.
Mar 12 2025, 6:54 AM

Mar 4 2025

mmel added a comment to D47514: riscv: enable allwinner RTC.

Unfortunately, the assumption about "In all the devices we currently support, the clock names in the "clock-output-names" property" is clearly incorrect. The documented binding for the A10/A20 does not allow any of these clocks. so this breaks every single A10/A20 board...

Mar 4 2025, 12:33 PM

Dec 8 2024

mmel committed rGabed528a9726: arm: align data section to the supersection. (authored by mmel).
arm: align data section to the supersection.
Dec 8 2024, 1:39 PM
mmel committed rGa9956e87506f: arm: add read_frequently, read_mostly and exclusive_cache_line sections to… (authored by mmel).
arm: add read_frequently, read_mostly and exclusive_cache_line sections to…
Dec 8 2024, 1:39 PM
mmel committed rGb9d95dc51a21: arm: fix symbols around the .ARM.exidx section (authored by mmel).
arm: fix symbols around the .ARM.exidx section
Dec 8 2024, 1:39 PM
mmel committed rGb66e0c51005a: arm: Fix typo in ldscript.arm. (authored by mmel).
arm: Fix typo in ldscript.arm.
Dec 8 2024, 1:39 PM
mmel committed rGd94ff663b6a6: arm: Fix VFP state corruption during signal delivery (authored by mmel).
arm: Fix VFP state corruption during signal delivery
Dec 8 2024, 1:39 PM
mmel committed rG52c00b65a76e: arm: switch the BUSDMA buffers to normal uncached memory (authored by mmel).
arm: switch the BUSDMA buffers to normal uncached memory
Dec 8 2024, 1:39 PM
mmel committed rG83ad268f7e0e: arm: align data section to the supersection. (authored by mmel).
arm: align data section to the supersection.
Dec 8 2024, 1:39 PM
mmel committed rGd321b707d6a9: arm: add read_frequently, read_mostly and exclusive_cache_line sections to… (authored by mmel).
arm: add read_frequently, read_mostly and exclusive_cache_line sections to…
Dec 8 2024, 1:38 PM
mmel committed rGc159be9a0a73: arm: fix symbols around the .ARM.exidx section (authored by mmel).
arm: fix symbols around the .ARM.exidx section
Dec 8 2024, 1:38 PM
mmel committed rGdf890fef1dcf: arm: Fix typo in ldscript.arm. (authored by mmel).
arm: Fix typo in ldscript.arm.
Dec 8 2024, 1:38 PM
mmel committed rG60799897ea89: arm: switch the BUSDMA buffers to normal uncached memory (authored by mmel).
arm: switch the BUSDMA buffers to normal uncached memory
Dec 8 2024, 1:38 PM

Nov 30 2024

mmel accepted D47848: genassym: Remove stale *if.h depends.
Nov 30 2024, 12:24 PM
mmel accepted D47847: arm: Use constants from sys/intr.h, not genassym.
Nov 30 2024, 12:24 PM
mmel accepted D47846: sys/intr.h: Make it safe to include from assembler.
Nov 30 2024, 12:23 PM

Nov 26 2024

mmel committed rG3abef90c325d: arm: Fix VFP state corruption during signal delivery (authored by mmel).
arm: Fix VFP state corruption during signal delivery
Nov 26 2024, 11:20 AM

Nov 24 2024

mmel added inline comments to D38696: arm: Unbreak debugging programs that use FP instructions.
Nov 24 2024, 12:01 PM
mmel added inline comments to D38698: arm: Fix initialization of VFP context.
Nov 24 2024, 11:55 AM
mmel added inline comments to D37419: arm: Add support for using VFP in kernel.
Nov 24 2024, 11:52 AM

Nov 17 2024

mmel committed rGb882d21558f3: arm: link all .rodata variants into one output section (authored by mmel).
arm: link all .rodata variants into one output section
Nov 17 2024, 11:37 AM
mmel committed rG60e72eb16a08: arm: align data section to the supersection. (authored by mmel).
arm: align data section to the supersection.
Nov 17 2024, 11:09 AM
mmel committed rGd98a18d032e6: arm: add read_frequently, read_mostly and exclusive_cache_line sections to… (authored by mmel).
arm: add read_frequently, read_mostly and exclusive_cache_line sections to…
Nov 17 2024, 11:09 AM
mmel committed rG1701dfae1be3: arm: fix symbols around the .ARM.exidx section (authored by mmel).
arm: fix symbols around the .ARM.exidx section
Nov 17 2024, 11:09 AM
mmel committed rG0381f0b63b9a: arm: Fix typo in ldscript.arm. (authored by mmel).
arm: Fix typo in ldscript.arm.
Nov 17 2024, 11:08 AM

Nov 11 2024

mmel committed rG248109448f6a: arm: switch the BUSDMA buffers to normal uncached memory (authored by mmel).
arm: switch the BUSDMA buffers to normal uncached memory
Nov 11 2024, 8:23 AM
mmel closed D47485: arm: switch the BUSDMA buffers to normal uncached memory.
Nov 11 2024, 8:23 AM

Nov 9 2024

mmel committed rG0283eebb4a54: arm: remove accidentally added -Map switch to linker (authored by mmel).
arm: remove accidentally added -Map switch to linker
Nov 9 2024, 7:32 AM
mmel committed rGba045ba49ded: arm: Improve the creation of kernel.bin (authored by mmel).
arm: Improve the creation of kernel.bin
Nov 9 2024, 7:17 AM
mmel closed D47488: arm: Improve the creation of kernel.bin.
Nov 9 2024, 7:16 AM

Nov 8 2024

mmel requested review of D47488: arm: Improve the creation of kernel.bin.
Nov 8 2024, 4:48 PM