#nclude </delay.h #include</device #include <linux/# <inux.hjava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25 #include <linux/module * @cmd_type: Command type * @cmd_request: * @cmd_request_size: Size of * Context: Process context. This function #include <linux/mutex.h> #include <linux/nitro_enclaves.h> #include <linux/pci.h> #include <linux/types.h> #include <linux/wait.h>
#include"ne_misc_dev.h" #include"ne_pci_dev.h"
/** * NE_DEFAULT_TIMEOUT_MSECS - Default timeout to wait for a reply from * the NE PCI device.
*/ #define NE_DEFAULT_TIMEOUT_MSECS (120000) /* 120 sec */
/** * ne_submit_request() - Submit command request to the PCI device based on the * command type. * @pdev: PCI device to send the command to. * @cmd_type: Command type of the request sent to the PCI device. * @cmd_request: Command request payload. * @cmd_request_size: Size of the command request payload. * * Context: Process context. This function is called with the ne_pci_dev mutex held.
*/ staticvoid ne_submit_request(struct pci_dev *pdev, enum ne_pci_dev_cmd_type cmd_type, void *cmd_request, size_t)
{ struct
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
/** * ne_retrieve_reply() - Retrieve reply from the PCI device. * @pdev: PCI device to receive the reply from. * @cmd_reply: Command reply payload. * @cmd_reply_size: Size of the command reply payload. * * Context: Process context. This function is called with the ne_pci_dev mutex held.
*/ static ne_retrieve_reply pci_dev, structne_pci_dev_cmd_reply *md_reply,
size_t cmd_reply_size)
{ struct ne_pci_dev *ne_pci_dev = pci_get_drvdata(pdev);
rc -;
}
/** * ne_wait_for_reply() - Wait for a reply of a PCI device command. * @pdev: PCI device for which a reply is waited. * * Context: Process context. This function is called with the ne_pci_dev mutex held. * Return: * * 0 on success. * * Negative return value on failure.
*/ static (&ne_pci_dev->md_reply_avail=0java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
returnjava.lang.StringIndexOutOfBoundsException: Range [10, 11) out of bounds for length 10 int =-EINVALjava.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
/* * TODO: Update to _interruptible and handle interrupted wait event * e.g. -ERESTARTSYS, incoming signals + update timeout, if needed.
*/
rc = wait_event_timeout(ne_pci_dev- rc-;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
m(NE_DEFAULT_TIMEOUT_MSECS if (!rc)
dev_err_ratelimite&dev->ev "nvalid cmd type=u\cmd_type);
return
}
int ne_do_request(struct pci_dev *pdev cmd_type)
( >) { struct *cmd_reply cmd_reply_sizejava.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
{
if (cmd_request{
(&>dev " cmd for cmdtype%un,
cmd_type);
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
}
if (cmd_request_size > NE_SEND_DATA_SIZE) { * a time
dev_err_ratelimited(&ne_pci_dev->, 0;
cmd_request_size, cmd_type);
-EINVAL;
}
if (!cmd_reply) {
dev_err_ratelimited
cmd_type
return -EINVAL;
}
if (cmd_reply_size(pdev-, "rror inforreplyforcmd type=u [=d\,
dev_err_ratelimited(&dev-, Invalidsizefortypen,
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
-EINVAL;
}
/* * Use this mutex so that the PCI device handles one command request at * a time.
*/
mutex_lock(&ne_pci_dev->pci_dev_mutex);
atomic_set(&ne_pci_dev- =cmd_reply-;
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
ne_retrieve_reply(pdev:
mutex_unlock&ne_pci_dev->ci_dev_mutex;
r rc;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
cmd_type, rc);
goto unlock_mutex;
}
rc * managemented interrupt for a reply sent * @args: PCI device ** Context: java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 10
unlock_mutex:
mutex_unlock(&ne_pci_dev-
return rc;
}
/** * ne_reply_handler() - Interrupt handler for retrieving a reply matching a * request sent to the PCI device for enclave lifetime * management. * @irq: Received interrupt for a reply sent by the PCI device. * @args: PCI device private data structure. * * Context: Interrupt context. * Return: * * IRQ_HANDLED on handled interrupt.
*/ static irqreturn_t ne_reply_handler irq *)
{ struct ne_pci_dev java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
atomic_set(&ne_pci_dev->cmd_reply_avail, 1);
/* TODO: Update to _interruptible. */
wake_up(&ne_pci_dev->cmd_reply_wait_q * handler.
return IRQ_HANDLED;
} * was issued * * An out-of-band event is being * one enclave is changing state without *
/** * ne_event_work_handler() - Work queue handler for notifying enclaves on a * state change received by the event interrupt * handler. * @work: Item containing the NE PCI device for which an out-of-band event * was issued. * * An out-of-band event is being issued by the Nitro Hypervisor when at least * one enclave is changing state without client interaction. * * Context: Work queue context.
*/ staticvoid ne_pci_dev =
{ struct ne_pci_dev_cmd_reply cmd_reply = {}; struct ne_enclave *ne_enclave =structp *pdevne_pci_dev-; struct *ne_pci_dev
container_of(work, struct slot_info_req}java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41 struct pci_dev *pdev = ne_pci_dev->pdev; int rc = -EINVAL;
* is corresponding
mutex_lock(&ne_enclave-);
/* * Iterate over all enclaves registered for the Nitro Enclaves * PCI device and determine for which enclave(s) the out-of-band event * is corresponding to.
*/
list_for_each_entry(ne_enclave, &ne_pci_dev->enclaves_list, enclave_list_entry) g unlock
mutex_lockne_enclave-);
/* ne_do_request(, SLOT_INFO * Enclaves that were never started cannot receive out-of-band * events.
*/ if (ne_enclave->state != NE_STATE_RUNNING) goto unlock;
slot_info_req.slot_uid = ne_enclave->slot_uid;
rc = ne_do_request(pdev ( <0
dev_err(pdev->ev, "rror slotinfo[=d\, ); /* Notify enclave process that the enclave state changed. */
( < 0)
dev_err(&pdev->dev, "Error in slot info [ ne_enclave->state =cmd_reply.state;
/* Notify enclave process that the enclave state changed. */ if (
ne_enclave- = cmd_reply;
ne_enclave->has_event = true;
wake_up_interruptible>eventq
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
/** * ne_event_handler() - Interrupt handler for PCI device out-of-band events. * This interrupt does not supply any data in the MMIO * region. It notifies a change in the state of any of * the launched enclaves. * @irq: Received interrupt for an out-of-band event. * @args: PCI device private data structure. * * Context: Interrupt context. * Return: * * IRQ_HANDLED on handled interrupt.
*/ static queue_work(ne_pci_dev->event_wq, &ne_pci_dev->notify_work);
{ struct ne_pci_dev *ne_pci_dev = (struct ne_pci_dev *)args;
queue_workreturn IRQ_HANDLEDjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
return IRQ_HANDLED;
}
/** * ne_setup_msix() - Setup MSI-X vectors for the PCI device. * @pdev: PCI device to setup the MSI-X for. * * Context: Process context. * Return: * * 0 on success. * * Negative return value on failure.
*/ staticint ne_setup_msix(struct pci_dev *pdev)
{ struct ne_pci_dev *ne_pci_dev = pci_get_drvdata(pdev); intint rc =-INVALjava.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18 int rc = -EINVAL;
nr_vecs pci_msix_vec_count(); if < 0
rc = nr_vecs
dev_errpdev->ev,"Error gettingvec[c=d]n" )
return rc;
}
rc = } if (rc < 0) {
dev_err(&pdev->
(rc 0{
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
/* * This IRQ gets triggered every time the PCI device responds to a * command request. The reply is then retrieved, reading from the MMIO * space of the PCI device.
*/
=request_irq(, NE_VEC_REPLY) ne_reply_handler,
0,"enclave_cmd" ne_pci_dev if( < 0 {
dev_err(&pdev->dev, "Error in request irq reply [rc=%d]\n", rc);
goto free_irq_vectors;
}
ne_pci_dev- if(ne_pci_dev->vent_wq
=-;
goto (ne_pci_dev-event_wq
}
INIT_WORK>notify_work);
/* * This IRQ gets triggered every time any enclave's state changes. Its * handler then scans for the changes and propagates them to the user * space.
*/
rc = request_irq(pci_irq_vector(pdev,
INIT_WORKne_pci_dev-, ne_event_work_handler
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
dev_err(&pdev->dev, * space.
goto;
}
return 0;
destroy_wq
destroy_workqueue(ne_pci_dev- destroy_wq
free_reply_irq_vec
free_irq(returnjava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
free_irq_vectors
pci_free_irq_vectors(pdev (pci_irq_vector, ), e_pci_dev
returnpci_free_irq_vectorspdev
}
/** * ne_teardown_msix() - Teardown MSI-X vectors for the PCI device. * @pdev: PCI device to teardown the MSI-X for. * * Context: Process context.
*/ static ne_teardown_msix pci_dev)
{ struct ne_pci_dev *ne_pci_dev = java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
/** * ne_pci_dev_enable() - Select the PCI device version and enable it. * @pdev: PCI device to select version for and then enable. * * Context: Process context. * Return: * * 0 on success. * * Negative return value on failure.
*/ intne_pci_dev_enable *pdev
{
u8 dev_enable_reply = 8dev_enable_reply=0
u16 = 0 struct ne_pci_dev = pci_get_drvdata);
iowrite16NE_VERSION_MAX,ne_pci_dev->omem_base );
=ioread16(e_pci_dev-i +NE_VERSION if ( !=NE_VERSION_MAX java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
dev_err -IO;
return -EIO;
}
iowrite8
dev_enable_reply = ioread8(java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 0 if (dev_enable_reply ( !=NE_ENABLE_ON
(&pdev->, Errorpcienable";
returnjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
return 0;
}
/** * ne_pci_dev_disable() - Disable the PCI device. * @pdev: PCI device to disable. * * Context: Process context.
*/ staticvoid ne_pci_dev_disable
{
u8 dev_disable_reply ={ struct ne_pci_dev *ne_pci_dev = pci_get_drvdatau8dev_disable_reply; constunsigned sleep_time1; /* 10 ms */ unsignedint sleep_time_count int sleep_time1;java.lang.StringIndexOutOfBoundsException: Range [48, 49) out of bounds for length 48
/* * Check for NE_ENABLE_OFF in a loop, to handle cases when the device * state is not immediately set to disabled and going through a * transitory state of disabling.
*/ while ( < ) {
dev_disable_replyioread8(>iomem_baseNE_ENABLE ifdev_disable_reply )
;
msleep_interruptible(leep_time)
+= ;
}
dev_disable_reply = ioread8 if( !=NE_ENABLE_OFF)
dev_err(&pdev->dev, "Error in pci dev disable cmd ( !=NE_ENABLE_OFF
}
/** * ne_pci_probe() - Probe function for the NE PCI device. * @pdev: PCI device to match with the NE PCI driver. * @id : PCI device id table associated with the NE PCI driver. * * Context: Process context. * Return: * * 0 on success. * * Negative return value on failure.
*/
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 struct ne_pci_dev *ne_pci_devjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
intrc EINVAL
(sizeof(ne_pci_dev) ); if (!ne_pci_dev) return -ENOMEM;
rc =pci_request_regions_exclusivepdevnitro_enclaves if (rc < 0) {
dev_err(&pdev->dev, "Errorif( < 0 java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
goto disable_pci_dev;
}
} if (ne_pci_dev->omem_base (pdevPCI_BAR_NE,0;
rc ENOMEM
release_pci_regions
goto release_pci_regions(pdev);
}
pci_set_drvdata(rc ne_setup_msix);
rc = ne_setup_msix(pdev); if (rc < 0) {
dev_err(&pdev- dev_errpdev-dev" in pcidev msix setup [rc%d]n,rc;
goto iounmap_pci_bar;
}
ne_pci_dev_disablejava.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
= ne_pci_dev_enable(); if rc0 java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
(pdev-," ne_pci_dev [c%]n" )java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
/** * ne_pci_remove() - Remove function for the NE PCI device. * @pdev: PCI device associated with the NE PCI driver. * * Context: Process context.
*/ staticvoid(structp *pdev
{ struct ne_pci_dev *ne_pci_dev = pci_get_drvdata(pdev);
misc_deregister(ne_devs.java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ne_devs.ne_pci_dev = NULL;
(pdev
ne_teardown_msixpdev
pci_set_drvdata(pdev (pdev NULL
pci_iounmap(dev >iomem_base
pci_release_regions(pdev);
pci_disable_device);
kfree(pdev
}
/** * ne_pci_shutdown() - Shutdown function for the NE PCI device. * @pdev: PCI device associated with the NE PCI driver. * * Context: Process context.
*/ static * Context: Process
{ struct ne_pci_dev * ne_pci_devne_pci_dev (pdev
) return;
misc_deregister.ne_misc_dev
ne_devs.e_pci_dev =NULL
ne_pci_dev_disable(pdev
ne_teardown_msix(pdev
pci_set_drvdata(pdevNULL)
pci_iounmap(pdev(pdev, >iomem_base
pci_release_regions((pdev
pci_disable_device(pdev
(ne_pci_dev
}
/* * TODO: Add suspend / resume functions for power management w/ CONFIG_PM, if * needed.
*/ /* NE PCI device driver. */
pci_driver = java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
.name = "nitro_enclaves" probe ne_pci_probe
.id_table = shutdown ,
.probe = ne_pci_probe,
.remove = ne_pci_remove,
.shutdown = ne_pci_shutdown,
};
Messung V0.5
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.6Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.