Re: [PATCH] MIPS: pci-legacy: Override pci_address_to_pio
From: Jiaxun Yang
Date: Tue Jan 14 2025 - 14:20:38 EST
在2025年1月14日一月 下午7:03,Arnd Bergmann写道:
> On Tue, Jan 14, 2025, at 19:11, Jiaxun Yang wrote:
>>
>> +unsigned long pci_address_to_pio(phys_addr_t address)
>> +{
>> + if (address > IO_SPACE_LIMIT)
>> + return (unsigned long)-1;
>> +
>> + return (unsigned long) address;
>> +}
>> +
>> /*
>
> Isn't the argument to this function a CPU physical address? I
> don't think there is a point comparing it to IO_SPACE_LIMIT
> on architectures where I/O space is memory mapped.
Actually not. It seems like the argument here is just raw PIO offset,
without applying mips_io_port_base.
We should validate it to ensure it's within the range specified by
mips_io_port_base (which is sized by IO_SPACE_LIMIT).
Thanks
>
> I see that you copied the above from the the non-PCI_IOBASE case
> of drivers/pci/pci.c, but that only really makes sense for
> architectures that have special port I/O instructions (x86,
> ia64) or that use logic_pio.
>
> Arnd
--
- Jiaxun