Re: [PATCH] cxl/region: Restore passthrough decoder enable on region re-assembly
From: Gregory Price
Date: Tue Jul 28 2026 - 00:22:59 EST
On Tue, Jul 28, 2026 at 11:03:37AM +0800, Richard Cheng wrote:
> On Mon, Jul 27, 2026 at 01:25:48PM +0800, Dave Jiang wrote:
>
> I think this part is talking about physical remove/insert ? sorry maybe I commit message was too vague about the scenario.
> The case here is a SW-only teardown via sysfs, this is what I did.
>
> """
> $ echo 1 > /sys/bus/pci/devices/$BDF/remove
> $ echo 1 > /sys/bus/pci/devices/$BDF/rescan
> """
>
> No physical removal, no power cycle, no link-down, no reset. Linux drops and re-enumerates the same device, which never stopped running.
> The endpoint HDM decoder is still committed.
>
> The device is byte-identical before and after, the kernel doesn't clear it either, the decoder is locked and cxl_decoder_reset() returns
> early for CXL_DECODER_F_LOCK before touching any register. The memory keeps decoding.
>
> I don't think anything needs re-programming here? the only thing lost is kernel-side bookkeeping on the passthrough decoder, which is
> freed with port and reallocated with F_ENABLE clear on rescan. The endpoint recovers its state from HW.
> The passthrough decoder has no HW to recover from, that asymmetry is the bug.
>
Being a passthrough decoder is just a special state of a switch decoder,
it doesn't necessarily imply programmability (Enable, Commit, Lock all
technically still apply, it's just ambiguous what they should be).
Wonder if we're just not setting these intermediate decoders up sanely.
If the endpoint is locked / not reprogrammable (commit / lock) on the
first go around, maybe the intermediate decoders should be force-locked
and not have F_ENABLE cleared on teardown? It's not like this actually
changes anything on the hardware, it's just bookkeeping.
(although i will say it's been a bit since i looked at the flag state
machine here, so i could be misremembering what the rules around ENABLE
are i this context).
Curious - what happens if you fully unload cxl_pci between
remove/rescan?
~Gregory