Re: [PATCH v6 07/10] cxl/pci: Split cxl_pci_setup_regs()

From: Ben Widawsky
Date: Wed Nov 10 2021 - 12:30:45 EST


On 21-11-10 17:14:37, Jonathan Cameron wrote:
> On Fri, 15 Oct 2021 16:30:42 -0700
> Dan Williams <dan.j.williams@xxxxxxxxx> wrote:
>
> > From: Ben Widawsky <ben.widawsky@xxxxxxxxx>
> >
> > In preparation for moving parts of register mapping to cxl_core, split
> > cxl_pci_setup_regs() into a helper that finds register blocks,
> > (cxl_find_regblock()), and a generic wrapper that probes the precise
> > register sets within a block (cxl_setup_regs()).
> >
> > Move the actual mapping (cxl_map_regs()) of the only register-set that
> > cxl_pci cares about (memory device registers) up a level from the former
> > cxl_pci_setup_regs() into cxl_pci_probe().
> >
> > With this change the unused component registers are no longer mapped,
> > but the helpers are primed to move into the core.
> >
> > [djbw: drop cxl_map_regs() for component registers]
> >
> > Signed-off-by: Ben Widawsky <ben.widawsky@xxxxxxxxx>
> > [djbw: rebase on the cxl_register_map refactor]
> > Reviewed-by: Ira Weiny <ira.weiny@xxxxxxxxx>
> > Reviewed-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
> > Signed-off-by: Dan Williams <dan.j.williams@xxxxxxxxx>
>
> Hi Ben / all,
>
> This is probably the best patch to comment on for this
> (note it is not a comment about this patch, but more the state we end up
> in after it).
>
> cxl_map_regs() is a generic function, but with the new split approach
> as a result of this patch, we now always know at the caller which of
> the types of map we are doing.
>
> I think it would be clearer to embrace that situation and drop cxl_map_regs()
> in favor of directly calling the relevant specific versions such as
> cxl_map_device_regs(). I can't immediately see how the generic cxl_map_regs()
> will be useful to us going forwards.
>
> Jonathan

I completely agree. Long term, something like cxl_map_regs() might be desirable
for a Type2 device, but we have no such user today. Patches welcome?