-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
librtas/vpd: prefer /dev/papr-vpd when available
Change rtas_get_vpd() to prefer the /dev/papr-vpd character device expected in Linux v6.8. On the first invocation of rtas_get_vpd(), probe for the new ABI and initialize an internal function pointer according to the result. Use pthread_once() to ensure that this probe step is performed atomically and only once. It would not make sense to re-probe (and potentially update the implementation) on every call, since the implementations differ in the way state for the call sequence is maintained. Assuming the new ABI is available: upon first call to rtas_get_vpd(), open /dev/papr-vpd and obtain a file descriptor using the PAPR_VPD_CREATE_HANDLE ioctl() command. This file descriptor is a reference to the VPD returned from a complete ibm,get-vpd call sequence. Subsequent calls sequentially read the VPD from the fd, which is closed once EOF is reached. To existing users of rtas_get_vpd(), the new implementation is indistinguishable from the old one, with one exception: * When using the rtas() syscall on current systems, RTAS advances the sequence number by a fixed interval on each call in a sequence. This is visible in the values returned in the 'seq_next' out parameter. * When using /dev/papr-vpd, the value returned in 'seq_next' does not change between calls; librtas treats it as a "handle" for a sequence in progress. In PAPR there is no meaning attached to the value returned in the 'seq_next' out parameter, and there is no requirement that it must change or increment on each call. No user should be relying on the behavior of this aspect of the interface to judge the status of a sequence. I have verified that an unmodified vpdupdate command from a distro lsvpd package works correctly when linked to a librtas.so with this change. This is the primary (and perhaps only) user of rtas_get_vpd(). For now, carry a copy of the kernel uapi header. Signed-off-by: Nathan Lynch <[email protected]> Signed-off-by: Tyrel Datwyler <[email protected]>
- Loading branch information
1 parent
c914a1a
commit 57d5e1c
Showing
3 changed files
with
162 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note | ||
#ifndef _UAPI_PAPR_VPD_H_ | ||
#define _UAPI_PAPR_VPD_H_ | ||
|
||
#include <asm/ioctl.h> | ||
#include "papr-miscdev.h" | ||
|
||
struct papr_location_code { | ||
/* | ||
* PAPR+ 12.3.2.4 Converged Location Code Rules - Length | ||
* Restrictions. 79 characters plus nul. | ||
*/ | ||
char str[80]; | ||
}; | ||
|
||
/* | ||
* ioctl for /dev/papr-vpd. Returns a VPD handle fd corresponding to | ||
* the location code. | ||
*/ | ||
#define PAPR_VPD_IOC_CREATE_HANDLE _IOW(PAPR_MISCDEV_IOC_ID, 0, struct papr_location_code) | ||
|
||
#endif /* _UAPI_PAPR_VPD_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters