Re: Serial device with PCI class memory device (0x05)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 8, 2019 at 3:00 PM Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
>
> On Tue, Jan 08, 2019 at 07:54:59AM +0100, Gerhard Khüny wrote:
> > On Mon, Jan 7, 2019 at 11:05 AM Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
> > >
> > > On Mon, Jan 07, 2019 at 10:55:28AM +0100, Gerhard Khüny wrote:
> > > > On Mon, Jan 7, 2019 at 10:05 AM Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
> > > > >
> > > > > On Mon, Jan 07, 2019 at 09:57:56AM +0100, Gerhard Khüny wrote:
> > > > > > Hello,
> > > > > >
> > > > > > I have a question regarding the function
> > > > > > serial_pci_is_class_communication() in 8250_pci:
> > > > > >
> > > > > > static int serial_pci_is_class_communication(struct pci_dev *dev) {
> > > > > >
> > > > > >         /*
> > > > > >         * If it is not a communications device or the programming
> > > > > >         * interface is greater than 6, give up.
> > > > > >         */
> > > > > >         if ((((dev->class >> 8) != PCI_CLASS_COMMUNICATION_SERIAL) &&
> > > > > >              ((dev->class >> 8) != PCI_CLASS_COMMUNICATION_MULTISERIAL) &&
> > > > > >              ((dev->class >> 8) != PCI_CLASS_COMMUNICATION_MODEM)) ||
> > > > > >             (dev->class & 0xff) > 6)
> > > > > >                return -ENODEV;
> > > > > >
> > > > > >         return 0;
> > > > > >
> > > > > > }
> > > > > >
> > > > > > We have implemented a serial interface in a FPGA. The existing driver
> > > > > > 8250_pci is working perfect for us. Only the check using the function
> > > > > > serial_pci_is_class_communication does not work since the PCI class is
> > > > > > 0x05, subclass is 0x00 and programming interface is 0x00 for our
> > > > > > device.
> > > > >
> > > > > Then fix your PCI device identifier structure :)
> > > > >
> > > > The problem is that the FPGA holds additional functionality (e.g. .
> > > > RTC, Hex-switch,..). The device therefore is not a real serial device
> > > > but it has implemented a serial interface.
> > >
> > > Ok, then you need to add a pci id to the serial driver.
> > >
> >
> > This is what I did.
>
> Great, all should be good then, right?
>

Unfortunately not. Maybe I did it wrong. I added one entry in pci_board_num_t,
one in  pci_boards and one serial_pci_tbl.
But in the probe function pciserial_init_one() the check
serial_pci_is_class_communication() fails.

> > > > > > My question is, if it is the intention to exclude PCI class memory
> > > > > > devices implementing a serial driver? The comment in the code could
> > > > > > say something different.
> > > > >
> > > > > If your device says it is a memory device and not a serial device, how
> > > > > could the kernel "know" it is really a serial device?
> > > > >
> > > > Because the init function returns no error.
> > > > Why not allow memory devices also?
> > >
> > > Because the generic pci memory device class is not a serial device.
> > >
> > > Again, please refer to the PCI specification for the details.  You can
> > > not have a generic class device suddenly be attached to a driver that is
> > > not the same as that class device.  For example, would you want your USB
> > > keyboard driver to suddenly attach to all USB modem devices just because
> > > one single vendor decided to implement keyboard functionality in a modem
> > > device but lie about what the class type was?
> > >
> > > Just add a new pci vendor/device id to the driver and you should be
> > > fine.  Or fix your pci device structure to not claim it is something
> > > other than what it really is.
> >
> > I totally agree that our device does not say what it really is. But the PCI
> > structure can't be changed.
>
> Why not?  It's a FPGA, can't you reprogram it?

The FPGA is used in different controllers with an other operation system.
Now we did some tests with Linux. Update of the FPGA would result in
effort which we don't want to spend.

>
> > Since the plausibility check was introduced recently I try to find an
> > solution which is mainline as much as possible.
>
> recently?  Looks to me like this has been there for a few decades now :)
>
> What git commit id are you looking at that you think just added this?

Okay, it's been a while ;-)
I refer to the commit 7d8905d serial: 8250_pci: Enable device after we
check black list

Regards,
Gerhard




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux