Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ofs: initial implementation of libofs #1899

Merged
merged 7 commits into from
Mar 9, 2021
Merged

Conversation

r-rojo
Copy link
Contributor

@r-rojo r-rojo commented Mar 4, 2021

libofs is meant to contain primitive routines for interfacing with a dfl
feature in user space. This will typically be mmio register space.
This first implementation is more of a staging and integration into the
opae-sdk repository and build system.
This currently contains two macros that can be used to wait for
variables to either be set to a specific value or different from a
specific value.

libofs is meant to contain primitive routines for interfacing with a dfl
feature in user space. This will typically be mmio register space.
This first implementation is more of a staging and integration into the
opae-sdk repository and build system.
This currently contains two macros that can be used to wait for
variables to either be set to a specific value or different from a
specific value.
@r-rojo r-rojo self-assigned this Mar 4, 2021
@r-rojo r-rojo requested a review from a team as a code owner March 4, 2021 20:26
@r-rojo r-rojo requested a review from michelleyho March 4, 2021 20:27
michelleyho
michelleyho previously approved these changes Mar 4, 2021
ofs/libofs/ofs_primitives.h Outdated Show resolved Hide resolved
ofs/libofs/ofs_primitives.h Outdated Show resolved Hide resolved
When doing time delta, account for the case when the lhs nsec happens to
be smaller than the rhs. When this happens, add 1E9 nsec to lhs nsec
before subtracting and subtract it from the sec component.
Comment on lines +30 to +36
opae_add_shared_library(
TARGET ofs
SOURCE ${src}
VERSION ${OPAE_VERSION}
SOVERSION ${OPAE_VERSION_MAJOR}
COMPONENT libofs
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be listed in opae.spec.in? And do you plan to create a new RPM package for? (I.e. opae-ofs.rpm)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably and most likely will be in some rpm or another. Because this is in a feature branch, I'm sort of laying the groundwork for this library as well as a user mode driver framework that I've been prototyping.

Comment on lines 46 to 51
clock_gettime(CLOCK_MONOTONIC, &now); \
uint64_t delta_sec = (now.tv_sec - begin.tv_sec)*1E9; \
uint64_t delta_nsec = now.tv_nsec < begin.tv_nsec) ? \
(1E9 + now.tv_nsec) - begin.tv_nsec + (delta_sec-1)*1E9 :\
now.tv_nsec - begin.tv_nsec + delta_sec*1E9; \
if (_timeout_usec*1E3 > delta_nsec) { \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it could be a useful macro, fx OFS_TIMESPEC_AFTER_USEC(_begin, _usec)

status; \
})

#define OFS_WAIT_FOR_CHANGE(_bit, _value, _timeout_usec, _sleep_usec) \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should OFS_WAIT_FOR_CHANGE() and OFS_WAIT_FOR() be documented somewhere ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'll probably document it along with other ofs APIs as it matures.

Move away from macros and use inline functions.
Add doxygen comments and inlclude gtest tests.
ofs/libofs/ofs_primitives.h Outdated Show resolved Hide resolved
ofs/libofs/ofs_primitives.h Outdated Show resolved Hide resolved
tests/libofs/test_libofs.cpp Show resolved Hide resolved
@r-rojo r-rojo merged commit b79847e into feature/ofs-umd Mar 9, 2021
@r-rojo r-rojo deleted the rrojo/ofs-umd branch March 9, 2021 18:27
r-rojo pushed a commit that referenced this pull request Mar 12, 2021
59ec00f libofs: add libofs and umd (user mode driver) framework
9561585 libofs: fix blank lines in files
b75690c libofs: finish migration to opae-libs repo
f552e4d ofs_parse: look for call nodes in ast
049e00a ofs-umd: fix ofs_resolve to check func.id
4006206 libofs: add macros to wait for bit fields
15bac6c ofs umd: add ofs umd framework (#1909)
e62592b ofs: initial implementation of libofs (#1899)

git-subtree-dir: opae-libs
git-subtree-split: 59ec00f
r-rojo pushed a commit that referenced this pull request Mar 12, 2021
a53e62e ofs-umd: fix ofs_add_driver cmake macro (#140)
59ec00f libofs: add libofs and umd (user mode driver) framework
9561585 libofs: fix blank lines in files
b75690c libofs: finish migration to opae-libs repo
f552e4d ofs_parse: look for call nodes in ast
049e00a ofs-umd: fix ofs_resolve to check func.id
4006206 libofs: add macros to wait for bit fields
15bac6c ofs umd: add ofs umd framework (#1909)
e62592b ofs: initial implementation of libofs (#1899)

git-subtree-dir: opae-libs
git-subtree-split: a53e62e
r-rojo added a commit that referenced this pull request Oct 11, 2021
* ofs: initial implementation of libofs

libofs is meant to contain primitive routines for interfacing with a dfl
feature in user space. This will typically be mmio register space.
This first implementation is more of a staging and integration into the
opae-sdk repository and build system.


This currently contains:
* macros to help with time related function/structures
* ofs_diff_timespec : C function that calculates difference between two timespec structs
* ofs_wait_for_eq32 and ofs_wait_for_eq64: Two functions that poll waiting for a pointer's value to equal a given value.
* simple unit tests for the added code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants