Re: [PATCH v2 1/2] PCI: endpoint: pci-epf-test: Add support for capabilities

Niklas Cassel
2024-12-03T04:43:14Z

Hello Mani,

On Sat, Nov 30, 2024 at 01:42:45PM +0530, Manivannan Sadhasivam wrote:
> >
> > struct pci_epf_test {
> > @@ -74,6 +76,7 @@ struct pci_epf_test_reg {
> > u32 irq_type;
> > u32 irq_number;
> > u32 flags;
> > + u32 caps;
>
> Can we rename the 'magic' register? It is not used since the beginning and I
> don't know if we will ever have a usecase for it.

It is actually used!

When doing PCITEST_BAR (pci_endpoint_test_bar()),
and barno == test->test_reg_bar, we are only filling the first 4 bytes,
rather than filling the whole BAR:
https://github.com/torvalds/linux/blob/v6.13-rc1/drivers/misc/pci_endpoint_test.c#L293-L294

These first 4 bytes are stored in the magic register.

I do agree that the magic register name is slightly misleading, but that
seems completely unrelated to this patch.

If you can come up with a better name, send a patch and you shall have
my Reviewed-by tag :)

Kind regards,
Niklas