Age | Commit message (Collapse) | Author |
|
Alex Elder pointed out that the macros also count the trailing NULL
('\0') character and so it should be using SIZE instead of LEN.
This patch makes that change.
Reported-by: Alex Elder <alex.elder@linaro.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
|
|
The backend processor may not be ready to return the version of firmware
it is running by the time AP requests for it. The greybus specification
is updated to return 1-byte 'status' to return the error type, RETRY is
one of them.
This patch implements that in greybus now.
Note that the version structure was common across interface and backend
version requests earlier, but that is changing as well.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
|
|
The specification got updated with two more status values, add their
support in greybus.
As retry isn't really an error, skip printing error messages for it as
well.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
|
|
This patch implements runtime PM support for firmware management bundle.
This guarantees that the bundle will be active, while the AP or the
Module is trying to exchange any operations over any of the CPorts.
- Firmware Management CPort:
Runtime PM get/put calls are placed around the ioctl calls, which are
all implemented as blocking ioctls.
- Component Authentication CPort:
Runtime PM get/put calls are placed around the ioctl calls, which are
all implemented as blocking ioctls.
- SPI:
Uses the interface provided by spilib.c and runtime PM get/put are
called around connection usage.
- firmware-download:
This is the most tricky one. All operations on this CPort are
initiated from the Module and not from the AP. And the AP needs to do
runtime_pm_get() before any request is received over this CPort.
The module doesn't send any request over this connection, unless the
AP has requested the module over firmware management CPort to download
a firmware package over firmware download CPort.
And so the runtime PM get/put calls around the ioctls in
fw-management.c are sufficient to handle the firmware management CPort
as well.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
|
|
This will make it consistent with any other character devices we have
for greybus and let us identify greybus character devices easily.
Compiled tested only.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
|
|
Add a comment to describe the purpose of the flag.
Suggested-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
|
|
This is the last step to required to finish the mode switch story. That
is, call the hook provided by Interface layer to accomplish mode switch.
Tested on EVT 1.5 with gpbridge-test module.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Tested-by: Karthik Ravi Shankar <karthikrs@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
|
|
Just reword it to make it sound better.
Compile tested.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
|
|
Fix below warnings observed with 'make check'.
~/ara/greybus/fw-management.c:438:33: warning: incorrect type in assignment (different base types)
~/ara/greybus/fw-management.c:438:33: expected unsigned short [unsigned] [addressable] [assigned] [usertype] major
~/ara/greybus/fw-management.c:438:33: got restricted __le16 [usertype] <noident>
~/ara/greybus/fw-management.c:439:33: warning: incorrect type in assignment (different base types)
~/ara/greybus/fw-management.c:439:33: expected unsigned short [unsigned] [addressable] [assigned] [usertype] minor
~/ara/greybus/fw-management.c:439:33: got restricted __le16 [usertype] <noident>
Reported-by: Greg Kroah-Hartman <gregkh@google.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
|
|
The fw-management driver rightly destroys the char device on
connection-exit, but that doesn't guarantee that all of the users of the
device are gone.
Userspace may still be holding file-descriptor of the char device and
can initiate new ioctl operations. And that *will* lead to kernel crash.
To avoid this issue, manage struct users with kref, manage a list of
'struct fw-mgmt' and start using the structure only after getting its
kref incremented.
The important part is the routine get_fw_mgmt(), which increments the
reference to the struct before returning it to the caller. The list of
fw-mgmt structs in protected with a mutex to avoid any races around
that.
The kref is incremented once the char device is opened and dropped only
when it is closed.
Reported-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
|
|
Once the interface firmware is loaded successfully to a module,
userspace can ask it to mode switch to the newly loaded firmware.
This patch provides a new ioctl to initiate mode switch.
Userspace can initiate a mode switch if it has previously loaded the
interface firmware successfully, otherwise the firmware core rejects it.
Also, once the mode-switch is initiated, disallow any more interactions
from the userspace.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Tested-by: Karthik Ravi Shankar <karthikrs@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
|
|
This patch adds Firmware Management Protocol support to firmware core,
which allows the AP to manage firmware on an Interface.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Jun Li <li_jun@projectara.com>
Tested-by: Karthik Ravi Shankar <karthikrs@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
|