> -----Original Message----- > From: Martin Mareš <mj@xxxxxx> > Sent: Wednesday, February 28, 2024 5:35 PM > To: Kobayashi, Daisuke/小林 大介 <kobayashi.da-06@xxxxxxxxxxx> > Cc: Kobayashi, Daisuke/小林 大介 <kobayashi.da-06@xxxxxxxxxxx>; > linux-cxl@xxxxxxxxxxxxxxx; Gotou, Yasunori/五島 康文 <y-goto@xxxxxxxxxxx>; > linux-pci@xxxxxxxxxxxxxxx; dan.j.williams@xxxxxxxxx > Subject: Re: [RFC PATCH v2 3/3] lspci: Add function to display cxl1.1 device > link status > > Hello! > > > This patch adds a function to output the link status of the CXL1.1 > > device when it is connected. > > > > In CXL1.1, the link status of the device is included in the RCRB > > mapped to the memory mapped register area. The value of that register > > is outputted to sysfs, and based on that, displays the link status information. > > I like using sysfs to access the RCRB, but since it is specific to Linux, you > cannot do it in ls-caps.c (everything in this file is platform-independent). > > The right way is to extend libpci and its interface to platform-specific > back-ends to provide this functionality. However, I am not sure that we should > add special functions just for this purpose. I will think of something more > general and let you know soon. > > Otherwise, please follow the coding style of the rest of the file. > > Martin Thank you for your comment. I understand that ls-caps.c requires a platform-independent implementation. I will look for an appropriate place to implement that. Is there a good place to add code to read files output to sysfs? For example, is it practical to add a function to lib/sysfs.c that reads and uses a specific sysfs file?