54 Commits

Author SHA1 Message Date
Sai Harshini Nimmala
921d71ac53 haven: hcall: Add Virtual PM group get state API
The state information of the Virtual PM group can be obtained
through this API.

Change-Id: I0a00e8bfe38f7908ed20bc105f66149097e6532b
Signed-off-by: Sai Harshini Nimmala <snimmala@codeaurora.org>
2020-10-22 20:49:24 -07:00
Jeykumar Sankaran
5c33d06a49 haven: hh_msgq: add MSGQ label for display
Display uses RM owned MSGQ for lending mem and irq res handles. In
addition, display may need to communicate custom data between the VMs
based on the value added display features that need to be supported
while the trusted VM applications are active. This change introduces
the MSGQ dedicated for display to establish the communication channel.

Change-Id: I8d07a3eb8591364f245c37a947a9ba5457c46efb
Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
2020-10-14 12:30:01 -07:00
qctecmdr
83a71adbff Merge "haven: Remove unused constants" 2020-10-07 12:10:24 -07:00
Isaac J. Manjarres
51e5c3a11e haven: Remove unused constants
No one is using HH_RM_MEM_NOTIFY_[OWNER/RECIPIENT]. Remove them.

Change-Id: I2ee4db2e9340fc291148f885a5098dea52b4ec0b
Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
2020-09-21 17:40:41 -07:00
Murali Nalajala
e98e9702f5 haven: irq_lend: add support for IRQ notifications
Currently IRQ APIs are combined with notifications to VMs for sharing the
handles. This limit the clients for managing the error handling from the
drivers. Hence separate the notifications from the actual APIs so that
clients manage the error handling better. Add support for notifications
like IRQ_LEND/ACCEPT/RELEASE from SVM to PVM when SVM accept the irq
handle shared by PVM.

Change-Id: I49999c2d9494c68b1542680e521c012a25e3f6a8
Signed-off-by: Murali Nalajala <mnalajal@codeaurora.org>
2020-09-21 15:14:37 -07:00
Isaac J. Manjarres
1451a11662 haven: Add support for the MEM_ACCEPTED notification
It's useful for other virtual machines (VMs) to know if another
VM has successfully received a resource that was shared with it
(e.g. state tracking can be controlled better with this sort of
information). Add support for the MEM_ACCEPTED notification, which
clients can use to notify the VM that owns the resource that was
shared with it that it has accepted the resource and is using it.
Also, add support in the mem-notifier driver to forward the
MEM_ACCEPTED notification to clients.

Change-Id: I05b9f1d37906d7c2aa729b97df2f8ceb78b560bd
Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
2020-09-11 09:28:08 -07:00
Elliot Berman
f7c7a20027 haven: irq: Support lending from other domains
Client drivers may lend IRQs with knowledge of only their GPIO interrupt
number, which would not directly have an underlying GIC hwirq. Thus,
tweak RM's understanding of IRQs to be aware of IRQ domains. Now, the
irq backed by GPIO will be translated to GIC domain.

Change-Id: I191d9e072b14f4501f5bbeb5d5263f50e0eef8c1
Signed-off-by: Elliot Berman <eberman@codeaurora.org>
2020-06-05 13:48:40 -07:00
Shashank Babu Chinta Venkata
b2e67efdbf haven: touch: add touch notify tag for memory sharing
Add touch tag to memory lend notification
framework to enable trusted touch usecase.

Change-Id: I71e30ac413728bb7bce9868b45996725824e1e02
Signed-off-by: Shashank Babu Chinta Venkata <sbchin@codeaurora.org>
2020-06-02 08:19:13 -07:00
Shashank Babu Chinta Venkata
a163768151 haven: touch: add IRQ label for trusted touch
Add IRQ label for irq lend framework for enabling
trusted touch usecase.

Change-Id: I6bc3fa5aaa8fd3a348fe9cf9883997e0138ed638
Signed-off-by: Shashank Babu Chinta Venkata <sbchin@codeaurora.org>
2020-06-02 08:18:16 -07:00
qctecmdr
a92558f282 Merge "haven: ctrl: Enable setting trace class" 2020-05-08 19:54:31 -07:00
qctecmdr
f0873c1708 Merge "haven: display: add IRQ label for display" 2020-05-06 23:50:34 -07:00
Elliot Berman
6e9663dcc1 haven: ctrl: Enable setting trace class
Clean up compiler warnings in haven control driver.

Change-Id: I6246a108f2e30c812071df9e5c1adbce12853fbf
Signed-off-by: Elliot Berman <eberman@codeaurora.org>
2020-05-04 09:50:57 -07:00
qctecmdr
a5d7a7b302 Merge "haven: dbl: Make hh_dbl_ functions wait for capid availability" 2020-05-03 01:19:18 -07:00
qctecmdr
6d967e6db5 Merge "arm64: defconfig: Enable CONFIG_HH_MEM_NOTIFIER" 2020-04-29 03:27:32 -07:00
qctecmdr
8841bd70d4 Merge "haven: rm: Add support to get hypervisor resources" 2020-04-29 03:27:31 -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
Murali Nalajala
cfa1320d7f soc: qcom: guestvm loader enhancements
RM-VM(Resource Manager) send various vm status notifications(INIT/READY/
RUNNING etc) back to primary VM while PIL loader is loading the VM
images. Listern to these notifications and make a call to get the
hypervisor resources to configure doorbell and message queues.

Change-Id: Ia378a1df82ef960e2c11bf715100e38de82b670c
Signed-off-by: Murali Nalajala <mnalajal@codeaurora.org>
2020-04-27 10:51:08 -07:00
qctecmdr
96de03ace9 Merge "haven: add sysfs and debug interfaces" 2020-04-26 19:14:55 -07:00
Elliot Berman
ea1de79279 haven: add sysfs and debug interfaces
This patch adds the /sys/hypervisor sysfs interface for the Haven
hypervisor. When running hosted on the Haven hypervisor, this interface
provides the Haven API and version information, and an interface for
controlling debug features. Haven also provides a call to disable its
UART driver. Disabling Haven's UART driver is exposed through a Kconfig
option.

Change-Id: I2a5ca7b01487e01e2d1dd56f5d15e826e70af081
Signed-off-by: Elliot Berman <eberman@codeaurora.org>
2020-04-24 15:34:56 -07:00
Elliot Berman
a7f85f2873 haven: rm: Update dt parsing to match Haven-supplied nodes
Haven hypervisor provides RM dt entries in a slightly different format
than has been used. Namely: the compatible string, capids are now
described by "reg" property, VMID/owner vmid is in a sibling DT node,
and names of some properties are changed. Thus, update RM driver to
parse accordingly. Common message queue dt parsing was moved into the
msgq driver helper function "hh_msgq_probe".

Change-Id: If3fe026bb6055267705a19d8ed7fd90ef0934270
Signed-off-by: Elliot Berman <eberman@codeaurora.org>
2020-04-23 18:42:52 -07:00
Jeykumar Sankaran
4fb4d222f9 haven: display: add IRQ label for display
Add IRQ label for display IRQ line.

Change-Id: Idf51363aba39242dd776443cd64b6e4980cf8ce3
Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
2020-04-23 12:51:01 -07:00
Jeykumar Sankaran
db4bdb31b4 haven: display: add display notify tag for memory sharing
Add display specific tag for memory sharing notifications.

Change-Id: I5cdad2c4e99fab7d3c71ae9e5865f99bfe5ccb05
Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
2020-04-23 12:47:24 -07:00
Isaac J. Manjarres
f1b97c8d6d haven: Introduce a memory sharing notification framework
Supplement the existing Haven memory resource notification
interface with a framework that can be used to dispatch
notifications about memory resources being shared/released
to the resource owners.

Change-Id: Ibbc14f4b29d68ffb1a9d6b035c79867783872225
Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
2020-04-23 11:43:37 -07:00
Isaac J. Manjarres
01497f5e88 haven: Align APIs and structures to account for the mem_info tag
The memory information tag is meant to be used in conjunction with
the memory notification interfaces to associate a label or tag with
a memory parcel. This memory information tag is meant to be used
for distinguishing between different memory resources that can be
transferred between Virtual Machines (VMs).

Change-Id: I6856284430ce5a78461c203904695aed25868706
Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
2020-04-22 10:25:03 -07:00
Murali Nalajala
32637a594d haven: add stubs to haven client exposed APIs
There are Non-VM (Virtual Machine) supported target drivers which
may refer some of the APIs defined for VMs. But those drivers are
compiled irrespective of VM or non-VM configurations. Add stubs to
support to compile drivers for non vm supported targets.

Change-Id: Ibc0c2c55b3b264c43c4793f153e723f8d344423a
Signed-off-by: Murali Nalajala <mnalajal@codeaurora.org>
2020-04-09 14:22:12 -07:00
Elliot Berman
18175354e0 haven: rm: Add haven vIRQ lending library
Add library for client drivers to lend interrupts to each other.

Change-Id: I4c60e0443d178e83c0bb4ec824915e4bdadb9c39
Signed-off-by: Elliot Berman <eberman@codeaurora.org>
2020-04-09 11:55:19 -07:00
Elliot Berman
479830ad51 haven: rm: Add calls to relase/reclaim IRQs
A VM may release a lent IRQ back to its lender. The lendee VM notifies
the resource manager that it may give the interrupt back to the lender
via its interrupt handle. The lender then must notify the lender VM that
it has released the interrupt. The lender VM must then reclaim the
interrupt via the handle.

Change-Id: Ic76f5a3692b4041bc3f260b4add06da11746f19e
Signed-off-by: Elliot Berman <eberman@codeaurora.org>
2020-04-09 11:55:19 -07:00
Elliot Berman
068a9a830d haven: rm: Allow IRQ lender to learn about the IRQ handle
An IRQ lender driver will likely ought to need to use the IRQ handle to
reclaim the interrupt when the lendee is done with the interrupt.

Change-Id: I0b791ecfb7b169d5cf2677d324e9aceea51feb5d
Signed-off-by: Elliot Berman <eberman@codeaurora.org>
2020-04-09 11:55:18 -07:00
Elliot Berman
0db6d0eafa haven: Clean up payload sizes
VMID is represented inconsistently in payload structs. Consistently use
hh_vmid_t to reduce mistakes around sizing of vmid. IRQ notify request
payload was also incorrectly formatted according to specification.

Change-Id: I0875655f69946eb0af609c67bdfdfa0dab5c7acc
Signed-off-by: Elliot Berman <eberman@codeaurora.org>
2020-04-09 11:55:17 -07:00
Elliot Berman
aba06b68e5 haven: msgq: Update EMPTY/FULL signals
Update handling of msgq response to send/recv to update internal state of
rx_empty/tx_full.

Change-Id: I8c744b2ed1dafc9b89576eb216a790d4f59530f5
Signed-off-by: Elliot Berman <eberman@codeaurora.org>
2020-04-09 11:55:15 -07:00
Elliot Berman
73eacbb2f3 haven: rm: Add HH_SELF_VM name
RM accepts "VMID 0" as meaning "self." Thus, add a vm_name "HH_SELF_VM"
which means the same. Haven RM console operates on vm_names and can use
HH_SELF_VM to talk to RM about this VM's console.

Change-Id: I7663db28497ad86a94d4a8c98f3b7068f5644915
Signed-off-by: Elliot Berman <eberman@codeaurora.org>
2020-04-09 11:55:14 -07:00
Raghavendra Rao Ananta
6bdb50ad99 haven: hh_msgq: Let clients manage the buffers for hh_msgq_recv
Currently, the hh_msgq driver allocates the receive-buffer on behalf
of the clients and it's the clients' responsibility to free it.
However, this creates asymmetry in the buffer management and may lead
to confusion. Hence, let the clients take full control of the buffers-
allocation and freeing.

Also make changes to the client driver to adapt to the new hh_msgq_recv
interface.

Change-Id: I95b72621ede5e62411e78e45c36d8a7ff3686bd4
Signed-off-by: Raghavendra Rao Ananta <rananta@codeaurora.org>
Signed-off-by: Murali Nalajala <mnalajal@codeaurora.org>
2020-04-06 09:16:04 -07:00
Jordan Crouse
1155af87e3 includes: Fix more headers to work with KERNEL_HEADER_TEST
Fix other headers to work when KERNEL_HEADER_TEST is enabled by adding
dependencies and advance struct prototypes where appropriate.

Change-Id: Ic0dedbad6804e5dca75b33b3d0ae9e3b89a51669
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2020-04-02 17:40:57 -06:00
Isaac J. Manjarres
4b38a9359f haven: Include notifer header file
The haven RM driver header file exposes functions where notifier
blocks are used. However, not all clients who include the
header file will necessarily have the notifier header file
in their source file, which causes compilation errors. Thus,
include the notifier header file in the RM driver header file
so that all other clients don't have to.

Change-Id: If74509e5d7fc2bbaeb4a427a7cd576f853fd8358
Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
2020-03-31 16:43:23 -07:00
Raghavendra Rao Ananta
1bdf8b9d3e haven: msgq: Initialize the cap-id with U64_MAX
Currently, the cap-id for Tx and Rx of the message-queue are
initialized with 0. However, 0 is a valid value for cap-id.
A better value to initialize the cap-id is with U64_MAX. Hence,
make corrections to use U64_MAX, defined as HH_CAPID_INVAL, in
the message-queue driver.

Change-Id: Ia501e87dc3cb8d880ea3d35ff000ca07b64aeced
Signed-off-by: Raghavendra Rao Ananta <rananta@codeaurora.org>
2020-03-29 13:00:48 -07:00
qctecmdr
b2d9f86807 Merge "haven: doorbell: Add neuron and qrtr labels" 2020-03-16 20:03:18 -07:00
Chris Lew
3c081b5e2a haven: doorbell: Add neuron and qrtr labels
Add labels for the neuron and qrtr labels. The neuron block protocol
requires two doorbell pairs and qrtr requires one doorbell pair.

Change-Id: I7d9c3da5ae620209b0d7a374bd487d567efbb97a
Signed-off-by: Chris Lew <clew@codeaurora.org>
2020-03-10 16:28:31 -07:00
Satya Durga Srinivasu Prabhala
cff714d423 haven: hcall: Add vcpu affinity API
vcpu affinity can be used to set or change the physical CPU affinity
of a VCPU thread.

Change-Id: I5f92205640ed1440e8ed0676e2bfcacbcef91f90
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
2020-03-06 09:51:20 -08:00
Elliot Berman
ce32b9ac95 haven: Pass doorbell irq number to client callback
Clients may need irq number to handle doorbell, e.g. to use a common irq
handler framework.

Change-Id: Iab64a0ce3330eab2b8fa052e9d8b9b9856510e6a
Signed-off-by: Elliot Berman <eberman@codeaurora.org>
2020-02-18 08:31:59 -08:00
Isaac J. Manjarres
aa7f44e9e2 haven: Add support for MEM_NOTIFY
MEM_NOTIFY is useful for sending VMs notifications about
memory that has been shared with them, as well as sending
owners of memory an indication that a VM has released memory
that they own, so add support for it.

Change-Id: I65bf0d000c8b3850f04c85eec70692728314b26d
Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
2020-02-13 16:26:18 -08:00
Isaac J. Manjarres
831fa9b6df haven: Add support for MEM_SHARE/MEM_LEND
Relying on hyp_assign for sharing memory is not sufficient,
as there are certain cases where hyp_assign is not applicable
for sharing memory (e.g. I/O memory). Add support for the MEM_SHARE
and MEM_LEND operations for sharing/lending memory with other
VMs respectively.

Change-Id: I7de502385a045f073540fa30c164b3410f6b5bd0
Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
2020-02-13 16:26:18 -08:00
Isaac J. Manjarres
ef8e696420 haven: Add support for the MEM_ACCEPT call
The MEM_ACCEPT call is required for VMs to map the
memory represented by a handle into their RM managed
page-tables, so add support for it.

Change-Id: I669ebd8298af405ca586a5721b26c4e19ffe39aa
Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
2020-02-13 16:26:18 -08:00
Isaac J. Manjarres
fbfc1adc6f haven: Add support for the MEM_RELEASE/MEM_RECLAIM calls
The MEM_RELEASE/MEM_RECLAIM RM calls are required to unmap memory
from the RM managed page-tables of VMs, as well as for VMs that
own memory to reclaim it respectively, so add support for it.

Change-Id: I6b8025cb08067331deb9cc89ec1d36c94c959c59
Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
2020-02-13 16:26:18 -08:00
Isaac J. Manjarres
d12ac73e1a haven: Add support for the MEM_QCOM_LOOKUP_SGL call
The MEM_QCOM_LOOKUP_SGL RM call is required to retrieve
handles for memparcels created through hyp assign. Thus,
add support for it in the RM driver.

Change-Id: Ib854187daffa13a44c948111ef560c3479f2590c
Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
2020-02-13 16:26:18 -08:00
Isaac J. Manjarres
53f0964dce haven: Add support for the mem-buf driver's message queue
Expose the label used for the mem-buf message queue.

Change-Id: I6f7c7629f9f6a4aefaea65653187ba210ef6ceb8
Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
2020-02-13 16:26:18 -08:00
Isaac J. Manjarres
c58ff8669f haven: Add the memparcel handle as a well known haven type
The memparcel handles are standard in the haven interface,
so expose them to the rest of the kernel.

Change-Id: Id8eafd5f3fe0f1403b9b76b9a0176c11d6546707
Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
2020-02-13 16:26:17 -08:00
Elliot Berman
ad9c03a8b0 haven: rm: Add VM Services - Console APIs
Add console APIs to emulate virtual console mechanism between SVM and
PVM to get the SVM messages to PVM for debug purpose.

Change-Id: I24ec2c427460195c83f5975de70f4ec5c4f2f763
Signed-off-by: Elliot Berman <eberman@codeaurora.org>
2020-02-10 12:34:03 -08:00
Elliot Berman
3415eaf8cb haven: rm: Add IRQ Management APIs for IRQ lending
RM allows VMs to lend interrupts to one another. This patch implements
the lender API.

Change-Id: I7671a2b346d2425f963631da4b8529fc9b10dc40
Signed-off-by: Elliot Berman <eberman@codeaurora.org>
2020-02-10 12:34:03 -08:00
Prakruthi Deepak Heragu
b1c2a1490d haven: Add VM management support for clients
Add VM management APIs so that clients can start VMs and allocate/get
vmids associated with VMs.

Change-Id: I7a9138a9479665f6c09aae98390a30c23011b3b1
Signed-off-by: Prakruthi Deepak Heragu <pheragu@codeaurora.org>
Signed-off-by: Elliot Berman <eberman@codeaurora.org>
2020-02-04 17:28:41 -08:00
Murali Nalajala
fbd0842e66 haven: Add haven doorbell driver
In haven one way to provide inter VMs(Virtual Machines)
communication is through the use of doorbell interrupts.
Individual VMs make use of these doorbells by calling
send and/or a receive primitives exposed by driver and
trigger an interrupt to each other and exchange the data.

Change-Id: I6d797d78cddc96a23680554e2b3fc1031446cbe5
Signed-off-by: Murali Nalajala <mnalajal@codeaurora.org>
Signed-off-by: Elliot Berman <eberman@codeaurora.org>
2020-02-04 17:28:41 -08:00