search for: ktime_add_ms

Displaying 20 results from an estimated 35 matches for "ktime_add_ms".

2018 Feb 14
0
[PATCH 3/4] iommu/virtio: Add event queue
..., sg, 1, 1, req, - GFP_ATOMIC); + ret = virtqueue_add_sgs(vq, sg, 1, 1, req, GFP_ATOMIC); if (ret) break; list_add_tail(&req->list, &pending); } - if (i && !virtqueue_kick(viommu->vq)) + if (i && !virtqueue_kick(vq)) return -EPIPE; timeout = ktime_add_ms(ktime_get(), timeout_ms * i); @@ -553,6 +570,70 @@ static int viommu_probe_endpoint(struct viommu_dev *viommu, struct device *dev) return ret; } +static int viommu_fault_handler(struct viommu_dev *viommu, + struct virtio_iommu_fault *fault) +{ + char *reason_str; + + u8 reason = fault->r...
2017 Nov 17
0
[RFC PATCH v2 3/5] iommu/virtio-iommu: Add event queue
..., sg, 1, 1, req, - GFP_ATOMIC); + ret = virtqueue_add_sgs(vq, sg, 1, 1, req, GFP_ATOMIC); if (ret) break; list_add_tail(&req->list, &pending); } - if (i && !virtqueue_kick(viommu->vq)) + if (i && !virtqueue_kick(vq)) return -EPIPE; timeout = ktime_add_ms(ktime_get(), timeout_ms * i); @@ -554,6 +570,70 @@ static int viommu_probe_endpoint(struct viommu_dev *viommu, struct device *dev) return 0; } +static int viommu_fault_handler(struct viommu_dev *viommu, + struct virtio_iommu_fault *fault) +{ + char *reason_str; + + u8 reason = fault->rea...
2020 Sep 15
0
[RFC PATCH 00/22] Enhance VHOST to enable SoC-to-SoC communication
...tio_pci_epf *pci_epf; +??? void __iomem *ioaddr; +??? ktime_t timeout; +??? bool timedout; +??? int ret = 0; +??? u8 status; + +??? pci_epf = to_virtio_pci_epf(vp_dev); +??? ioaddr = vp_dev->ioaddr; + +??? mutex_lock(&pci_epf->lock); +??? writeb(command, ioaddr + HOST_CMD); +??? timeout = ktime_add_ms(ktime_get(), COMMAND_TIMEOUT); +??? while (1) { +??? ??? timedout = ktime_after(ktime_get(), timeout); +??? ??? status = readb(ioaddr + HOST_CMD_STATUS); + Several questions: - It's not clear to me how the synchronization is done between the RC and EP. E.g how and when the value of HOST_CMD_...
2020 Aug 21
0
[PATCH v3 5/6] iommu/virtio: Support topology description in config space
...(dev, pos + VPCI_FIELD(length), + &cap->length); + pci_read_config_dword(dev, pos + VPCI_FIELD(offset), + &cap->offset); + + return pos; + } + return 0; +} + +static int viommu_pci_reset(struct virtio_pci_common_cfg __iomem *cfg) +{ + u8 status; + ktime_t timeout = ktime_add_ms(ktime_get(), 100); + + iowrite8(0, &cfg->device_status); + while ((status = ioread8(&cfg->device_status)) != 0 && + ktime_before(ktime_get(), timeout)) + msleep(1); + + return status ? -ETIMEDOUT : 0; +} + +static void viommu_pci_parse_topology(struct pci_dev *dev) +{...
2020 Sep 04
1
[PATCH v3 5/6] iommu/virtio: Support topology description in config space
...th); > + pci_read_config_dword(dev, pos + VPCI_FIELD(offset), > + &cap->offset); > + > + return pos; > + } > + return 0; > +} > + > +static int viommu_pci_reset(struct virtio_pci_common_cfg __iomem *cfg) > +{ > + u8 status; > + ktime_t timeout = ktime_add_ms(ktime_get(), 100); > + > + iowrite8(0, &cfg->device_status); > + while ((status = ioread8(&cfg->device_status)) != 0 && > + ktime_before(ktime_get(), timeout)) > + msleep(1); > + > + return status ? -ETIMEDOUT : 0; > +} > + > +static void...
2020 Sep 18
0
[RFC PATCH 00/22] Enhance VHOST to enable SoC-to-SoC communication
...atus; >>>> + >>>> +??? pci_epf = to_virtio_pci_epf(vp_dev); >>>> +??? ioaddr = vp_dev->ioaddr; >>>> + >>>> +??? mutex_lock(&pci_epf->lock); >>>> +??? writeb(command, ioaddr + HOST_CMD); >>>> +??? timeout = ktime_add_ms(ktime_get(), COMMAND_TIMEOUT); >>>> +??? while (1) { >>>> +??? ??? timedout = ktime_after(ktime_get(), timeout); >>>> +??? ??? status = readb(ioaddr + HOST_CMD_STATUS); >>>> + >>>> >>>> Several questions: >>>> >&...
2018 Jan 16
1
[RFC PATCH v2 3/5] iommu/virtio-iommu: Add event queue
...add_sgs(vq, sg, 1, 1, req, GFP_ATOMIC); > if (ret) > break; > > list_add_tail(&req->list, &pending); > } > > - if (i && !virtqueue_kick(viommu->vq)) > + if (i && !virtqueue_kick(vq)) > return -EPIPE; > > timeout = ktime_add_ms(ktime_get(), timeout_ms * i); > @@ -554,6 +570,70 @@ static int viommu_probe_endpoint(struct viommu_dev *viommu, struct device *dev) > return 0; > } > > +static int viommu_fault_handler(struct viommu_dev *viommu, > + struct virtio_iommu_fault *fault) > +{ > + char *r...
2020 Sep 16
0
[RFC PATCH 00/22] Enhance VHOST to enable SoC-to-SoC communication
...timedout; >> +??? int ret = 0; >> +??? u8 status; >> + >> +??? pci_epf = to_virtio_pci_epf(vp_dev); >> +??? ioaddr = vp_dev->ioaddr; >> + >> +??? mutex_lock(&pci_epf->lock); >> +??? writeb(command, ioaddr + HOST_CMD); >> +??? timeout = ktime_add_ms(ktime_get(), COMMAND_TIMEOUT); >> +??? while (1) { >> +??? ??? timedout = ktime_after(ktime_get(), timeout); >> +??? ??? status = readb(ioaddr + HOST_CMD_STATUS); >> + >> >> Several questions: >> >> - It's not clear to me how the synchronization i...
2018 Jan 15
1
[RFC PATCH v2 1/5] iommu: Add virtio-iommu driver
...gt; + ret = virtqueue_add_sgs(viommu->vq, sg, 1, 1, req, > + GFP_ATOMIC); > + if (ret) > + break; > + > + list_add_tail(&req->list, &pending); > + } > + > + if (i && !virtqueue_kick(viommu->vq)) > + return -EPIPE; > + > + timeout = ktime_add_ms(ktime_get(), timeout_ms * i); I don't really understand how you choose your timeout value: 1s per sent request. > + while (nr_received < i && ktime_before(ktime_get(), timeout)) { > + nr_received += viommu_receive_resp(viommu, i - nr_received, > + &pending); &gt...
2017 Nov 17
11
[RFC PATCH v2 0/5] Add virtio-iommu driver
Implement the virtio-iommu driver following version 0.5 of the specification [1]. Previous version of this code was sent back in April [2], implementing the first public RFC. Since then there has been lots of progress and discussion on the specification side, and I think the driver is in a good shape now. The reason patches 1-3 are only RFC is that I'm waiting on feedback from the Virtio TC
2017 Nov 17
11
[RFC PATCH v2 0/5] Add virtio-iommu driver
Implement the virtio-iommu driver following version 0.5 of the specification [1]. Previous version of this code was sent back in April [2], implementing the first public RFC. Since then there has been lots of progress and discussion on the specification side, and I think the driver is in a good shape now. The reason patches 1-3 are only RFC is that I'm waiting on feedback from the Virtio TC
2018 Oct 12
3
[PATCH v3 5/7] iommu: Add virtio-iommu driver
...{ > + int ret = 0; > + unsigned int len; > + size_t write_len; > + ktime_t timeout = 0; > + struct viommu_request *req; > + struct virtqueue *vq = viommu->vqs[VIOMMU_REQUEST_VQ]; > + > + assert_spin_locked(&viommu->request_lock); > +#ifdef DEBUG > + timeout = ktime_add_ms(ktime_get(), VIOMMU_REQUEST_TIMEOUT); > +#endif > + virtqueue_kick(vq); > + > + while (!list_empty(&viommu->requests)) { > + len = 0; > + req = virtqueue_get_buf(vq, &len); > + if (req == NULL) { > + if (!timeout || ktime_before(ktime_get(), timeout)) > +...
2018 Oct 12
3
[PATCH v3 5/7] iommu: Add virtio-iommu driver
...{ > + int ret = 0; > + unsigned int len; > + size_t write_len; > + ktime_t timeout = 0; > + struct viommu_request *req; > + struct virtqueue *vq = viommu->vqs[VIOMMU_REQUEST_VQ]; > + > + assert_spin_locked(&viommu->request_lock); > +#ifdef DEBUG > + timeout = ktime_add_ms(ktime_get(), VIOMMU_REQUEST_TIMEOUT); > +#endif > + virtqueue_kick(vq); > + > + while (!list_empty(&viommu->requests)) { > + len = 0; > + req = virtqueue_get_buf(vq, &len); > + if (req == NULL) { > + if (!timeout || ktime_before(ktime_get(), timeout)) > +...
2018 Jun 21
0
[PATCH v2 2/5] iommu: Add virtio-iommu driver
...requests that were in-flight at the time of the call have completed. + */ +static int __viommu_sync_req(struct viommu_dev *viommu) +{ + int ret = 0; + unsigned int len; + size_t write_len; + struct viommu_request *req; + struct virtqueue *vq = viommu->vqs[VIOMMU_REQUEST_VQ]; + ktime_t timeout = ktime_add_ms(ktime_get(), VIOMMU_REQUEST_TIMEOUT); + + assert_spin_locked(&viommu->request_lock); + + virtqueue_kick(vq); + + while (!list_empty(&viommu->requests)) { + len = 0; + req = virtqueue_get_buf(vq, &len); + if (req == NULL) { + if (ktime_before(ktime_get(), timeout)) + contin...
2018 Oct 12
0
[PATCH v3 5/7] iommu: Add virtio-iommu driver
...int __viommu_sync_req(struct viommu_dev *viommu) +{ + int ret = 0; + unsigned int len; + size_t write_len; + ktime_t timeout = 0; + struct viommu_request *req; + struct virtqueue *vq = viommu->vqs[VIOMMU_REQUEST_VQ]; + + assert_spin_locked(&viommu->request_lock); +#ifdef DEBUG + timeout = ktime_add_ms(ktime_get(), VIOMMU_REQUEST_TIMEOUT); +#endif + virtqueue_kick(vq); + + while (!list_empty(&viommu->requests)) { + len = 0; + req = virtqueue_get_buf(vq, &len); + if (req == NULL) { + if (!timeout || ktime_before(ktime_get(), timeout)) + continue; + + /* After timeout, remove a...
2018 Feb 14
0
[PATCH 1/4] iommu: Add virtio-iommu driver
...g[0] = &req->top; + sg[1] = &req->bottom; + + ret = virtqueue_add_sgs(viommu->vq, sg, 1, 1, req, + GFP_ATOMIC); + if (ret) + break; + + list_add_tail(&req->list, &pending); + } + + if (i && !virtqueue_kick(viommu->vq)) + return -EPIPE; + + timeout = ktime_add_ms(ktime_get(), timeout_ms * i); + while (nr_received < i && ktime_before(ktime_get(), timeout)) { + nr_received += viommu_receive_resp(viommu, i - nr_received, + &pending); + if (nr_received < i) + cpu_relax(); + } + + if (nr_received != i) + ret = -ETIMEDOUT; + + if (r...
2018 Feb 14
12
[PATCH 0/4] Add virtio-iommu driver
Implement the virtio-iommu driver following version 0.6 of the specification [1]. Previous version, RFCv2, was sent in November [2]. This version addresses Eric's comments and changes the device number. (Since last week I also tested and fixed the probe/release functions, they now use devm properly.) I did not include ACPI support because the next IORT specifications isn't ready yet (even
2018 Feb 14
12
[PATCH 0/4] Add virtio-iommu driver
Implement the virtio-iommu driver following version 0.6 of the specification [1]. Previous version, RFCv2, was sent in November [2]. This version addresses Eric's comments and changes the device number. (Since last week I also tested and fixed the probe/release functions, they now use devm properly.) I did not include ACPI support because the next IORT specifications isn't ready yet (even
2018 Nov 08
0
[PATCH v3 5/7] iommu: Add virtio-iommu driver
...igned int len; >> + size_t write_len; >> + ktime_t timeout = 0; >> + struct viommu_request *req; >> + struct virtqueue *vq = viommu->vqs[VIOMMU_REQUEST_VQ]; >> + >> + assert_spin_locked(&viommu->request_lock); >> +#ifdef DEBUG >> + timeout = ktime_add_ms(ktime_get(), VIOMMU_REQUEST_TIMEOUT); >> +#endif >> + virtqueue_kick(vq); >> + >> + while (!list_empty(&viommu->requests)) { >> + len = 0; >> + req = virtqueue_get_buf(vq, &len); >> + if (req == NULL) { >> + if (!timeout || ktime_befor...
2017 Nov 17
0
[RFC PATCH v2 1/5] iommu: Add virtio-iommu driver
...g[0] = &req->top; + sg[1] = &req->bottom; + + ret = virtqueue_add_sgs(viommu->vq, sg, 1, 1, req, + GFP_ATOMIC); + if (ret) + break; + + list_add_tail(&req->list, &pending); + } + + if (i && !virtqueue_kick(viommu->vq)) + return -EPIPE; + + timeout = ktime_add_ms(ktime_get(), timeout_ms * i); + while (nr_received < i && ktime_before(ktime_get(), timeout)) { + nr_received += viommu_receive_resp(viommu, i - nr_received, + &pending); + if (nr_received < i) { + /* + * FIXME: what's a good way to yield to host? A second +...