27 Sep, 2016

1 commit


16 Jun, 2016

1 commit


16 May, 2016

1 commit

  • The Interface description in the Greybus specification contains a
    'features' field which is currently not implemented on the AP side. The
    Interface features field provides information on optional attributes of an
    Interface as a bitmask. Currently only GREYBUS_INTERFACE_FEATURE_TIMESYNC
    is implemented in the specification but, the expectation is that other
    feature flags will be added over time.

    This patch adds support to extract the feature byte communicated in the
    features field of the Interface Descriptor header and extends struct
    interface to contain a features field through which any user with a pointer
    to struct interface may interrogate the features of an Interface.

    This is a necessary pre-cursor for TimeSync to ensure only Interfaces which
    declare GREYBUS_INTERFACE_FEATURE_TIMESYNC will be included when we go
    through the process of FrameTime synchronization.

    Signed-off-by: Bryan O'Donoghue
    Signed-off-by: Greg Kroah-Hartman

    Bryan O'Donoghue
     

21 Apr, 2016

2 commits

  • The control device is an abstraction of the control connection over
    which a greybus manifest is retrieved. As interfaces switch modes (e.g.
    after boot-over-unipro) they expose new manifests, which can contain
    different vendor and product strings.

    Eventually control devices will be deregistered and recreated after an
    interface mode switch, while the interface itself remains registered.

    Note that only interfaces of type greybus will have control devices.
    Specifically, dummy interfaces will not.

    Signed-off-by: Johan Hovold
    Reviewed-by: Viresh Kumar
    Signed-off-by: Greg Kroah-Hartman

    Johan Hovold
     
  • The manifest-parsing code could end up leaving the interface
    vendor_string set to an error pointer that we'd eventually try to free
    when destroying the interface.

    Signed-off-by: Johan Hovold
    Reviewed-by: Viresh Kumar
    Signed-off-by: Greg Kroah-Hartman

    Johan Hovold
     

16 Feb, 2016

1 commit

  • The order in which cports (of a bundle) are present in the manifest blob
    is important for gbsim, as it allocates hd_cport_id's for them
    sequentially.

    For example, if there are two cports (1 and 2, in order 1->2) present in
    a bundle in the manifest blob, then gbsim allocates hd_cport_id X and
    X+1 for them. This is done on the assumption that kernel will do the
    same. Though it shouldn't have had any such assumptions since the
    beginning.

    But with a recent patch that sequence is changed, and it broke the
    assumption gbsim had.

    While parsing the manifest blob, the cports within a bundle are now
    moved to another list using list_move() and then they are picked one by
    one from the HEAD of the list.

    list_move() first deletes the node and then adds it to HEAD as it uses
    list_add() and not list_add_tail(). And that reverses the order in which
    the cports were present in the original list.

    And because of this, the messages destined for cport 1 are delivered to
    cport 2 and the ones for cport 2 are delivered to cport 1.

    In order to get gbsim working with greybus, keep the cport list in the
    order in which they were present in manifest, by replacing list_move()
    with list_move_tail().

    Its a trivial patch and shouldn't have any side effects on the working
    of greybus with nuttx.

    Signed-off-by: Viresh Kumar
    Reviewed-by: Alex Elder
    Reviewed-by: Johan Hovold
    Signed-off-by: Greg Kroah-Hartman

    Viresh Kumar
     

12 Feb, 2016

1 commit


04 Feb, 2016

1 commit


22 Jan, 2016

2 commits

  • Now that connection creation has been separated from interface
    initialisation, we should explicitly check for duplicate CPort
    descriptors when parsing the manifest.

    Reviewed-by: Viresh Kumar
    Signed-off-by: Johan Hovold
    Signed-off-by: Greg Kroah-Hartman

    Johan Hovold
     
  • Defer connection creation to bundle driver probe instead of creating
    them when initialising the interface and parsing the manifest.

    Store copies of the CPorts descriptors in the bundle for the drivers to
    use, and update the legacy driver.

    This is needed for drivers that need more control over host-device
    resource management, for example, when a protocol needs to use a
    dedicated host CPort for traffic offloading (e.g. camera data).

    This also avoids allocating host CPorts for bundles that are not bound
    to a driver or for remote CPorts that a driver does not need.

    Reviewed-by: Viresh Kumar
    Signed-off-by: Johan Hovold
    Signed-off-by: Greg Kroah-Hartman

    Johan Hovold
     

09 Dec, 2015

4 commits


05 Dec, 2015

1 commit

  • Because the width of our fields is already known, we can use %0Nx (for
    hex) to print N bytes and %u (for unsigned decimal), instead of using %h
    and %hh, which isn't that readable.

    This patch makes following changes:
    - s/%hx/%04x
    - s/%04hx/%04x
    - s/%hhx/%02x
    - s/%02hhx/%02x
    - s/%hhu/%u
    - s/%hu/%u
    - s/%x/%02x for u8 value (only at a single place)

    Suggested-by: Johan Hovold
    Signed-off-by: Viresh Kumar
    Reviewed-by: Johan Hovold
    Signed-off-by: Greg Kroah-Hartman

    Viresh Kumar
     

26 Nov, 2015

3 commits

  • Drop the control bundle and ignore control descriptors when parsing
    manifests.

    Every interface has a control connection with a well defined remote
    CPort 0 and there's no longer any need to create a bundle for it.

    As the control connection is setup and enabled before parsing the
    manifest, ignore any legacy descriptors for control cports and bundles
    in a manifest.

    Signed-off-by: Johan Hovold
    Signed-off-by: Greg Kroah-Hartman

    Johan Hovold
     
  • Add helper function to release cport-descriptors with a given bundle id.

    Signed-off-by: Johan Hovold
    Signed-off-by: Greg Kroah-Hartman

    Johan Hovold
     
  • Clean up the connection-creation interface by clearly separating our two
    types of connections: static and dynamic.

    Add two convenience functions for creating static and dynamic connections.

    A static connection is a pre-setup connection that is defined by a host
    device and a host-device cport id. Specifically, the remote interface or
    cport id need not be known. The SVC connection is a static connection.

    A dynamic connection is defined by a host device and a remote interface
    and cport id. This is our normal connections where the host-device cport
    is (generally) allocated dynamically.

    Note that the new generic interface is marked static, but can be
    exported later to allow dynamic connections to be created also from
    fixed host-device cports (e.g. for CSI).

    Also note that a connection of either type is uniquely identified by its
    host-device and host-device cport id once created.

    Signed-off-by: Johan Hovold
    Signed-off-by: Greg Kroah-Hartman

    Johan Hovold
     

24 Nov, 2015

1 commit

  • This patch doesn't change any functionality. It just improves the
    readability of the code.
    Current code to get 'descriptors' pointer looks as if we are forcing the
    pointer type change. To simplify the address calculations, use
    'descriptors' member directly from greybus_manifest structure.

    Signed-off-by: Sachin Pandhare
    Reviewed-by: Viresh Kumar
    Signed-off-by: Greg Kroah-Hartman

    Sachin Pandhare
     

22 Nov, 2015

2 commits

  • Fix vendor and product matching by matching on the 32-bit Ara vendor and
    product ids.

    Remove the "fake" 16-bit vendor and product ids and export the Ara ids
    using the "vendor" and "product" interface attributes instead.

    Signed-off-by: Johan Hovold
    Signed-off-by: Greg Kroah-Hartman

    Johan Hovold
     
  • Remove the unimplemented interface unique-id.

    There will eventually be an interface-serial-number attribute provided,
    but let's not export it or commit to a name for this attribute until we
    need it.

    Signed-off-by: Johan Hovold
    Signed-off-by: Greg Kroah-Hartman

    Johan Hovold
     

17 Nov, 2015

1 commit

  • The descriptor list is walked in two points, in the bundle parsing and
    cport parsing, this can make the next descriptor pointer in bundle to be
    already removed by the cport remove descriptor and become invalid.

    So, just get the next bundle until there no more left.

    Signed-off-by: Rui Miguel Silva
    Signed-off-by: Greg Kroah-Hartman

    Rui Miguel Silva
     

03 Nov, 2015

1 commit


15 Sep, 2015

2 commits

  • If we fail to initialize a cport of a bundle, we abort the entire
    bundle. But that leads to following (unnecessary) warnings as few of the
    cport descriptors, belonging to the aborted bundle were never parsed:

    "greybus: excess descriptors in interface manifest"

    Fix that by releasing all cport descriptors for the aborted bundle.

    Signed-off-by: Viresh Kumar
    Reviewed-by: Johan Hovold
    Signed-off-by: Greg Kroah-Hartman

    Viresh Kumar
     
  • A 'bundle' represents a device in greybus. It may require multiple
    cports for its functioning. If we fail to setup any cport of a bundle,
    we better reject the complete bundle as the device may not be able to
    function properly then.

    But, failing to setup a cport of bundle X doesn't mean that the device
    corresponding to bundle Y will not work properly. Bundles should be
    treated as separate independent devices.

    While parsing manifest for an interface, treat bundles as separate
    entities and don't reject entire interface and its bundles on failing to
    initialize a cport. But make sure the bundle which needs the cport, gets
    destroyed properly.

    We now release the bundle descriptor before parsing the cports, but that
    shouldn't make any difference.

    Signed-off-by: Viresh Kumar
    Reviewed-by: Johan Hovold
    Signed-off-by: Greg Kroah-Hartman

    Viresh Kumar
     

23 Jul, 2015

2 commits

  • This patch converts a dangling pr_err in the manifest parsing error path to
    a dev_err in order to remain consistent with similar error messages
    elsewhere.

    Signed-off-by: Bryan O'Donoghue
    Reviewed-by: Viresh Kumar
    Signed-off-by: Greg Kroah-Hartman

    Bryan O'Donoghue
     
  • 5ae6906e ('interface: Get manifest using Control protocol') in
    gb_create_control_connection introduces the concept that the Control
    Protocol is at cport_id 2 and bundle_id 0. Currently the manifest parsing
    code does not enforce that concept and as a result it is possible for a
    manifest to declare the Control Protocol at a different address.

    Based on that change 6a6945c9684e ('greybus-spec/control: Formally define
    Control Protocol reserved addresses') makes the above coding convention a
    formal requirement of the greybus specification. This patch implements the
    change introduced in the specification @ 6a6945c9684e.

    This patch will reject a manifest if it doesn't match the critiera laid
    down in the spec.

    This patch makes three changes:
    - Changes gb_manifest_parse_cports so that only GB_CONTROL_CPORT_ID may
    have a protocol_id of GREYBUS_PROTOCOL_CONTROL, otherwise the manifest
    will be rejected.
    - Changes gb_manifest_parse_bundles so that only GB_CONTROL_BUNDLE_ID may
    have a class of GREYBUS_CLASS_CONTROL, otherwise the manifest will be
    rejected.
    - gb_connection_exit() and gb_connection_destroy() are removed from
    gb_manifest_parse_cports on error - since gb_manifest_parse_bundles()
    already has a call into gb_bundle_destroy() which will again call
    gb_connection_exit() and gb_connection_destroy() leading to an oops.

    Signed-off-by: Bryan O'Donoghue
    Reviewed-by: Viresh Kumar
    Signed-off-by: Greg Kroah-Hartman

    Bryan O'Donoghue
     

09 Jul, 2015

1 commit

  • gb_connection_create() can initialize a connection if bundle->device id
    is valid. And so the connection must be destroyed by calling
    gb_connection_exit() before gb_connection_destroy(). This wasn't done in
    the code that is parsing the manifest.

    Fix it.

    Signed-off-by: Viresh Kumar
    Signed-off-by: Greg Kroah-Hartman

    Viresh Kumar
     

24 Jun, 2015

3 commits

  • It is possible that (by mistake) the manifest contains non-control
    cports with their protocol set as control-protocol or non-control bundle
    with their class set as control-class.

    Catch such cases, WARN for them and finally ignore them.

    Also WARN if the control cport doesn't have its protocol as
    control-protocol and control bundle doesn't have its class as
    control-class.

    Reviewed-by: Alex Elder
    Signed-off-by: Viresh Kumar
    Signed-off-by: Greg Kroah-Hartman

    Viresh Kumar
     
  • Control protocol is ready to be used for fetching manifest. Lets do it.

    This changes few things:
    - Creates/initializes bundle/connection for control protocol initially
    and skips doing the same later.
    - Manifest is parsed at link-up now, instead of hotplug which was the
    case earlier. This is because we need device_id (provided during
    link-up) for registering bundle.
    - Manifest is fetched using control protocol.

    So the sequence of events is:

    Event Previously Now
    ----- ---------- ---
    Interface Hotplug create intf create intf
    parse mfst

    Interface Link Up init bundles create control conn
    get mfst size
    get mfst
    parse mfst
    init bundles

    Reviewed-by: Alex Elder
    Signed-off-by: Viresh Kumar
    Signed-off-by: Greg Kroah-Hartman

    Viresh Kumar
     
  • A connection and a bundle will be created for interfaces at the very
    beginning for control protocol's functioning. And so the list of bundles
    and connections for a interface will be non-empty by the time manifest
    is parsed.

    Currently we are firing a WARN when these lists are found to be
    non-empty. Lets fix that to contain single bundle and connection for
    control protocol.

    Signed-off-by: Viresh Kumar
    Signed-off-by: Greg Kroah-Hartman

    Viresh Kumar
     

16 Jun, 2015

1 commit

  • We limit the number of host-side CPorts to a fixed maximum (which
    is less than the 4096 that UniPro allows). This patch imposes a
    similar limit on the CPort IDs defined by modules (signaling an
    error if one too large is found in a manifest).

    It seems reasonable to use the same value for both limits. Change
    the name of the constant that defines the host limit and use it for
    both. Update cport_id_valid() to enforce the maximum.

    (Ultimately we should impose a limit like this; this change is being
    made in preparation for supporting multiple connections over a
    single CPort.)

    Signed-off-by: Alex Elder
    Signed-off-by: Greg Kroah-Hartman

    Alex Elder
     

13 Jun, 2015

2 commits

  • Currently, if an error occurs creating a bundle, we simply
    return an error without cleaning up any of the bundles that
    had already been successfully set up.

    Add code to destroy bundles that have been created in the event
    an error occurs. Add a check to ensure the interface's list of
    bundles was empty before parsing for bundles begins.

    Signed-off-by: Alex Elder
    Signed-off-by: Greg Kroah-Hartman

    Alex Elder
     
  • Currently, if an error occurs creating a connection, we simply
    return an error without cleaning up any of the connections that
    had already been successfully set up.

    Add code to destroy connections that have been created in the event
    an error occurs. Add a check to ensure the bundle's list of
    connections was empty before parsing for CPorts begins.

    Signed-off-by: Alex Elder
    Signed-off-by: Greg Kroah-Hartman

    Alex Elder
     

11 Jun, 2015

5 commits

  • Rework the the code that parses the manifest for bundles so it only
    touches each manifest descriptor once. (Previously the list was
    scanned from the beginning repeatedly until all bundles were found.)
    Shorten the name of the descriptor variable, to avoid line wrap.

    Signed-off-by: Alex Elder
    Signed-off-by: Greg Kroah-Hartman

    Alex Elder
     
  • Rework the the code that parses the manifest for CPorts associated
    with a bundle so it only touches each manifest descriptor once.
    (Previously the list was scanned from the beginning repeatedly
    until all bundle CPorts were found.) Shorten the name of the
    descriptor variable, to avoid line wrap.

    Signed-off-by: Alex Elder
    Signed-off-by: Greg Kroah-Hartman

    Alex Elder
     
  • An initialized bundle structure contains a pointer to its
    interface. Because of this there's no need to provide
    the interface pointer to gb_manifest_parse_cports(). This
    also precludes the possibility of passing a bad interface
    pointer.

    Signed-off-by: Alex Elder
    Signed-off-by: Greg Kroah-Hartman

    Alex Elder
     
  • This patch incorporates some very small cleanups to "manifest.c":
    - Rearrange code a bit in gb_manifest_parse() that ensures a
    manifest is big enough to hold a header. If the manifest is
    exactly the size of a header, the error reported will now be
    "...must have 1 interface..." rather than "short manifest".
    - Fix the function comment for gb_manifest_parse_cports().
    - Use "an interface," not "a interface," and don't capitalize.
    - Delete some braces when getting interface product string.
    - A few other minor changes to comments and white space.

    Signed-off-by: Alex Elder
    Signed-off-by: Greg Kroah-Hartman

    Alex Elder
     
  • There's no need to include anything other than "greybus.h" in
    "connection.c". Same thing in "core.c" and "manifest.c" and
    "svc.c". Some files need headers included, but most come along
    with "greybus.h".

    Signed-off-by: Alex Elder
    Signed-off-by: Greg Kroah-Hartman

    Alex Elder
     

09 Jun, 2015

1 commit