Commit Graph

12 Commits

Author SHA1 Message Date
Chris Lew
daa0f471a9 net: neuron: channel: Move waitq init
Initialize the waitq before registering with the doorbell framework to
prevent uninitialized variable access.

Change-Id: Icb902b829a6af52716713b18891e4e35c0c2a620
Signed-off-by: Chris Lew <clew@codeaurora.org>
2021-01-29 13:15:21 -08:00
Chris Lew
ca1c9dc6bf net: neuron: channel: Check buffer boundaries
Sanitize the ring buffer length read from the other side to ensure
the bounds match the memory that is mapped.

Change-Id: Ifdac3e0dee11374e61ede3a2cfb82e1957c6a2b2
Signed-off-by: Chris Lew <clew@codeaurora.org>
2020-11-12 15:09:46 -08:00
Chris Lew
d5e3b87efb neuron: ch_haven: Add support for svm device tree format
The secondary vm device tree will have a different format than the
primary vm. Try parsing the node as a secondary vm node if the
shared-buffer region does not exist.

Change-Id: Id794a1b21507329f4e16f1335a17a2262ecabd5a
Signed-off-by: Chris Lew <clew@codeaurora.org>
2020-06-15 19:52:25 -07:00
Chris Lew
66af98dc3f neuron: ch_haven: Add memory sharing support
The carved out or allocated memory may not be configured to be
accessible by both the owner and consumer vms. Add support to share
memory through hyp_assign_phy() and assign a label to the resultant
memparcel through hh_rm_mem_qcom_lookup_sgl().

This sharing sequence should only be done by the owner of the reserved
memory region. Currently we indicate this with the qcom,primary tag in
device tree.

Change-Id: Idf5658ab4cf0d1c022f6b919914a8e782318c8d7
Signed-off-by: Chris Lew <clew@codeaurora.org>
2020-06-15 19:52:25 -07:00
Chris Lew
6826400d8d neuron: ch_haven: Store haven label for future use
Store the haven label so it can be used for other haven resources such
as attaching it to memparcels that are shared.

Change-Id: I90717bc7d158fb73ecb4442ede3c5d476f3d2045
Signed-off-by: Chris Lew <clew@codeaurora.org>
2020-06-15 19:52:25 -07:00
Chris Lew
0fc1e59781 neuron: ch_haven: Read peer name from device tree
Add support for the primary vm to read the vm peer name from device
tree. This information is needed to share memory to the peer vm.

Change-Id: I9a38370c8b80480bcdd0988c515adf64b36f99c1
Signed-off-by: Chris Lew <clew@codeaurora.org>
2020-06-15 19:52:25 -07:00
qctecmdr
a5d7a7b302 Merge "haven: dbl: Make hh_dbl_ functions wait for capid availability" 2020-05-03 01:19:18 -07:00
Elliot Berman
23f7911bfe haven: dbl: Make hh_dbl_ functions wait for capid availability
Client drivers may successfully register with a doorbell even before
doorbell capids are known to Linux. However, we do need to know capids
for send, read, reset, and mask functions. Here, we mirror the behavior
of message queues by placing the calling thread in a waitqueue until the
capids are populated by RM.

Change-Id: Ie1cf98d0fe344bb2a878bb655db78705d4292ff9
Signed-off-by: Elliot Berman <eberman@codeaurora.org>
2020-04-27 10:51:10 -07:00
Chris Lew
90f8f682ed neuron: ch_haven: Move msgq init to sync thread
The neuron channels may init and probe before the secondary vm is
loaded and the resources queried from resource manager. This results
in either a blocking call or EAGAIN returned when sending a doorbell.

Move the msgq_init call from the probe to the channel sync thread. This
will ensure the init thread can continue if the doorbell send api needs
to block or busywait loop.

Change-Id: I0f5562968d59a3dc0a361aca9e4e60ffebcb70be
Signed-off-by: Chris Lew <clew@codeaurora.org>
2020-04-27 10:51:09 -07:00
Chris Lew
85c2118a11 neuron: block_client: Wait for channel to init
Wait until all conditions are met instead of busy looping to check if
the channels are finished initializing.

Change-Id: I50bd3bad6ccf3f4957ed0a98cdceed45d49fe851
Acked-by: Chris Henroid <chenroid@qti.qualcomm.com>
Signed-off-by: Chris Lew <clew@codeaurora.org>
2020-04-22 16:14:07 -07:00
Chris Lew
a0a416b179 neuron: block_client: Fix init loop
Depending on timing there is a chance the channel initialization will
happen at different intervals. When this happens, the first channel
wakeup will be cleared by the init loop and never be set again by the
channel init.  This leads to a stall in init because both channels
will never have both their wakeups set to signal channel init done.

Change-Id: I435e78c3e4b83cf6b827d3827f35d1e6a1b297fa
Acked-by: Chris Henroid <chenroid@qti.qualcomm.com>
Signed-off-by: Chris Lew <clew@codeaurora.org>
2020-04-21 11:42:06 -07:00
Chris Lew
6493564fe3 net: Add Neuron Framework
Neuron is a device-sharing framework which is used by guests of the
haven hypervisor to serve or access shared I/O devices and other
inter-VM services.

There are three main layers that make up a neuron service.
channel - the physical layer transport that uses the hypervisor
          provided transports.

protocol - defines the syntax and semantics to virtualize a specific
           device across VMs. Block and Net are examples of protocols.

application - integrates the neuron service components into the rest of
              the system. There would be front and back end application
              drivers for the net protocol.

Change-Id: Ic7278fdaee1cd30147e91e1126643bce79c05e52
Signed-off-by: Chris Lew <clew@codeaurora.org>
2020-03-30 21:44:24 -07:00