Displaying 20 results from an estimated 51 matches for "virtio_iommu_map_f_write".
2019 Jul 22
3
[PATCH] iommu/virtio: Update to most recent specification
...phys_addr_t paddr, size_t size, int prot)
{
int ret;
- int flags;
+ u32 flags;
struct virtio_iommu_req_map map;
struct viommu_domain *vdomain = to_viommu_domain(domain);
@@ -718,6 +724,9 @@ static int viommu_map(struct iommu_domain *domain, unsigned long iova,
(prot & IOMMU_WRITE ? VIRTIO_IOMMU_MAP_F_WRITE : 0) |
(prot & IOMMU_MMIO ? VIRTIO_IOMMU_MAP_F_MMIO : 0);
+ if (flags & ~vdomain->map_flags)
+ return -EINVAL;
+
ret = viommu_add_mapping(vdomain, iova, paddr, size, flags);
if (ret)
return ret;
@@ -1027,7 +1036,8 @@ static int viommu_probe(struct virtio_device *vdev)
got...
2019 Jul 22
3
[PATCH] iommu/virtio: Update to most recent specification
...phys_addr_t paddr, size_t size, int prot)
{
int ret;
- int flags;
+ u32 flags;
struct virtio_iommu_req_map map;
struct viommu_domain *vdomain = to_viommu_domain(domain);
@@ -718,6 +724,9 @@ static int viommu_map(struct iommu_domain *domain, unsigned long iova,
(prot & IOMMU_WRITE ? VIRTIO_IOMMU_MAP_F_WRITE : 0) |
(prot & IOMMU_MMIO ? VIRTIO_IOMMU_MAP_F_MMIO : 0);
+ if (flags & ~vdomain->map_flags)
+ return -EINVAL;
+
ret = viommu_add_mapping(vdomain, iova, paddr, size, flags);
if (ret)
return ret;
@@ -1027,7 +1036,8 @@ static int viommu_probe(struct virtio_device *vdev)
got...
2019 Jul 22
0
[PATCH] iommu/virtio: Update to most recent specification
...t; {
> int ret;
> - int flags;
> + u32 flags;
> struct virtio_iommu_req_map map;
> struct viommu_domain *vdomain = to_viommu_domain(domain);
>
> @@ -718,6 +724,9 @@ static int viommu_map(struct iommu_domain *domain, unsigned long iova,
> (prot & IOMMU_WRITE ? VIRTIO_IOMMU_MAP_F_WRITE : 0) |
> (prot & IOMMU_MMIO ? VIRTIO_IOMMU_MAP_F_MMIO : 0);
>
> + if (flags & ~vdomain->map_flags)
> + return -EINVAL;
> +
> ret = viommu_add_mapping(vdomain, iova, paddr, size, flags);
> if (ret)
> return ret;
> @@ -1027,7 +1036,8 @@ static int vi...
2019 Jul 22
0
[PATCH] iommu/virtio: Update to most recent specification
...t; {
> int ret;
> - int flags;
> + u32 flags;
> struct virtio_iommu_req_map map;
> struct viommu_domain *vdomain = to_viommu_domain(domain);
>
> @@ -718,6 +724,9 @@ static int viommu_map(struct iommu_domain *domain, unsigned long iova,
> (prot & IOMMU_WRITE ? VIRTIO_IOMMU_MAP_F_WRITE : 0) |
> (prot & IOMMU_MMIO ? VIRTIO_IOMMU_MAP_F_MMIO : 0);
>
> + if (flags & ~vdomain->map_flags)
> + return -EINVAL;
> +
> ret = viommu_add_mapping(vdomain, iova, paddr, size, flags);
> if (ret)
> return ret;
> @@ -1027,7 +1036,8 @@ static int vi...
2018 Jun 13
0
[RFC] virtio-iommu version 0.7
...address space once this request completes.
After all endpoints have been successfully detached from a domain, it
ceases to exist and its ID can be reused by the driver for another domain.
@@ -457,6 +452,7 @@ struct virtio_iommu_req_map {
#define VIRTIO_IOMMU_MAP_F_READ (1 << 0)
#define VIRTIO_IOMMU_MAP_F_WRITE (1 << 1)
#define VIRTIO_IOMMU_MAP_F_EXEC (1 << 2)
+#define VIRTIO_IOMMU_MAP_F_MMIO (1 << 3)
\end{lstlisting}
Map a range of virtually-contiguous addresses to a range of
@@ -478,15 +474,23 @@ guest-physical addresses for use by the host (for instance MSI doorbells).
Guest p...
2017 Oct 09
0
[virtio-dev] [RFC] virtio-iommu version 0.4
...paddr, size);
@@ -564,17 +566,30 @@ static int viommu_map(struct iommu_domain *domain, unsigned long iova,
if (!vdomain->attached)
return -ENODEV;
- if (prot & IOMMU_READ)
- req.flags |= cpu_to_le32(VIRTIO_IOMMU_MAP_F_READ);
-
- if (prot & IOMMU_WRITE)
- req.flags |= cpu_to_le32(VIRTIO_IOMMU_MAP_F_WRITE);
-
ret = viommu_tlb_map(vdomain, iova, paddr, size);
if (ret)
return ret;
- ret = viommu_send_req_sync(vdomain->viommu, &req);
+ req = kzalloc(sizeof(*req), GFP_KERNEL);
+ if (!req)
+ return -ENOMEM;
+
+ *req = (struct virtio_iommu_req_map) {
+ .head.type = VIRTIO_IOMMU_T_MAP,
+...
2019 May 30
0
[PATCH v8 5/7] iommu: Add virtio-iommu driver
...*domain, unsigned long iova,
+ phys_addr_t paddr, size_t size, int prot)
+{
+ int ret;
+ u32 flags;
+ struct virtio_iommu_req_map map;
+ struct viommu_domain *vdomain = to_viommu_domain(domain);
+
+ flags = (prot & IOMMU_READ ? VIRTIO_IOMMU_MAP_F_READ : 0) |
+ (prot & IOMMU_WRITE ? VIRTIO_IOMMU_MAP_F_WRITE : 0) |
+ (prot & IOMMU_MMIO ? VIRTIO_IOMMU_MAP_F_MMIO : 0);
+
+ if (flags & ~vdomain->map_flags)
+ return -EINVAL;
+
+ ret = viommu_add_mapping(vdomain, iova, paddr, size, flags);
+ if (ret)
+ return ret;
+
+ map = (struct virtio_iommu_req_map) {
+ .head.type = VIRTIO_IOMMU_T_MAP,
+...
2017 Apr 07
0
[RFC PATCH linux] iommu: Add virtio-iommu driver
...};
+
+ pr_debug("map %llu 0x%lx -> 0x%llx (%zu)\n", vdomain->id, iova,
+ paddr, size);
+
+ if (!vdomain->attached)
+ return -ENODEV;
+
+ if (prot & IOMMU_READ)
+ req.flags |= cpu_to_le32(VIRTIO_IOMMU_MAP_F_READ);
+
+ if (prot & IOMMU_WRITE)
+ req.flags |= cpu_to_le32(VIRTIO_IOMMU_MAP_F_WRITE);
+
+ ret = viommu_tlb_map(vdomain, iova, paddr, size);
+ if (ret)
+ return ret;
+
+ ret = viommu_send_req_sync(vdomain->viommu, &req);
+ if (ret)
+ viommu_tlb_unmap(vdomain, iova, size);
+
+ return ret;
+}
+
+static size_t viommu_unmap(struct iommu_domain *domain, unsigned long iova,
+...
2017 Jun 16
1
[virtio-dev] [RFC PATCH linux] iommu: Add virtio-iommu driver
...address, do you know why kernel does this?
Thanks
-Bharat
> +
> + if (!vdomain->attached)
> + return -ENODEV;
> +
> + if (prot & IOMMU_READ)
> + req.flags |= cpu_to_le32(VIRTIO_IOMMU_MAP_F_READ);
> +
> + if (prot & IOMMU_WRITE)
> + req.flags |= cpu_to_le32(VIRTIO_IOMMU_MAP_F_WRITE);
> +
> + ret = viommu_tlb_map(vdomain, iova, paddr, size);
> + if (ret)
> + return ret;
> +
> + ret = viommu_send_req_sync(vdomain->viommu, &req);
> + if (ret)
> + viommu_tlb_unmap(vdomain, iova, size);
> +
> + return ret;
> +}
> +
> +static size_t v...
2017 Jun 16
1
[virtio-dev] [RFC PATCH linux] iommu: Add virtio-iommu driver
...address, do you know why kernel does this?
Thanks
-Bharat
> +
> + if (!vdomain->attached)
> + return -ENODEV;
> +
> + if (prot & IOMMU_READ)
> + req.flags |= cpu_to_le32(VIRTIO_IOMMU_MAP_F_READ);
> +
> + if (prot & IOMMU_WRITE)
> + req.flags |= cpu_to_le32(VIRTIO_IOMMU_MAP_F_WRITE);
> +
> + ret = viommu_tlb_map(vdomain, iova, paddr, size);
> + if (ret)
> + return ret;
> +
> + ret = viommu_send_req_sync(vdomain->viommu, &req);
> + if (ret)
> + viommu_tlb_unmap(vdomain, iova, size);
> +
> + return ret;
> +}
> +
> +static size_t v...
2018 Oct 12
3
[PATCH v3 5/7] iommu: Add virtio-iommu driver
...)
> +{
> + int ret;
> + int flags;
> + struct viommu_mapping *mapping;
> + struct virtio_iommu_req_map map;
> + struct viommu_domain *vdomain = to_viommu_domain(domain);
> +
> + flags = (prot & IOMMU_READ ? VIRTIO_IOMMU_MAP_F_READ : 0) |
> + (prot & IOMMU_WRITE ? VIRTIO_IOMMU_MAP_F_WRITE : 0) |
> + (prot & IOMMU_MMIO ? VIRTIO_IOMMU_MAP_F_MMIO : 0);
> +
> + mapping = viommu_add_mapping(vdomain, iova, paddr, size, flags);
> + if (!mapping)
> + return -ENOMEM;
> +
> + map = (struct virtio_iommu_req_map) {
> + .head.type = VIRTIO_IOMMU_T_MAP,
> + .dom...
2018 Oct 12
3
[PATCH v3 5/7] iommu: Add virtio-iommu driver
...)
> +{
> + int ret;
> + int flags;
> + struct viommu_mapping *mapping;
> + struct virtio_iommu_req_map map;
> + struct viommu_domain *vdomain = to_viommu_domain(domain);
> +
> + flags = (prot & IOMMU_READ ? VIRTIO_IOMMU_MAP_F_READ : 0) |
> + (prot & IOMMU_WRITE ? VIRTIO_IOMMU_MAP_F_WRITE : 0) |
> + (prot & IOMMU_MMIO ? VIRTIO_IOMMU_MAP_F_MMIO : 0);
> +
> + mapping = viommu_add_mapping(vdomain, iova, paddr, size, flags);
> + if (!mapping)
> + return -ENOMEM;
> +
> + map = (struct virtio_iommu_req_map) {
> + .head.type = VIRTIO_IOMMU_T_MAP,
> + .dom...
2018 Nov 22
0
[PATCH v5 5/7] iommu: Add virtio-iommu driver
...*domain, unsigned long iova,
+ phys_addr_t paddr, size_t size, int prot)
+{
+ int ret;
+ int flags;
+ struct virtio_iommu_req_map map;
+ struct viommu_domain *vdomain = to_viommu_domain(domain);
+
+ flags = (prot & IOMMU_READ ? VIRTIO_IOMMU_MAP_F_READ : 0) |
+ (prot & IOMMU_WRITE ? VIRTIO_IOMMU_MAP_F_WRITE : 0) |
+ (prot & IOMMU_MMIO ? VIRTIO_IOMMU_MAP_F_MMIO : 0);
+
+ ret = viommu_add_mapping(vdomain, iova, paddr, size, flags);
+ if (ret)
+ return ret;
+
+ map = (struct virtio_iommu_req_map) {
+ .head.type = VIRTIO_IOMMU_T_MAP,
+ .domain = cpu_to_le32(vdomain->id),
+ .virt_start = cpu_t...
2018 Nov 15
0
[PATCH v4 5/7] iommu: Add virtio-iommu driver
...phys_addr_t paddr, size_t size, int prot)
+{
+ int ret;
+ int flags;
+ struct viommu_mapping *mapping;
+ struct virtio_iommu_req_map map;
+ struct viommu_domain *vdomain = to_viommu_domain(domain);
+
+ flags = (prot & IOMMU_READ ? VIRTIO_IOMMU_MAP_F_READ : 0) |
+ (prot & IOMMU_WRITE ? VIRTIO_IOMMU_MAP_F_WRITE : 0) |
+ (prot & IOMMU_MMIO ? VIRTIO_IOMMU_MAP_F_MMIO : 0);
+
+ mapping = viommu_add_mapping(vdomain, iova, paddr, size, flags);
+ if (!mapping)
+ return -ENOMEM;
+
+ map = (struct virtio_iommu_req_map) {
+ .head.type = VIRTIO_IOMMU_T_MAP,
+ .domain = cpu_to_le32(vdomain->id),
+ .virt_...
2018 Jun 21
0
[PATCH v2 2/5] iommu: Add virtio-iommu driver
...phys_addr_t paddr, size_t size, int prot)
+{
+ int ret;
+ int flags;
+ struct viommu_mapping *mapping;
+ struct virtio_iommu_req_map map;
+ struct viommu_domain *vdomain = to_viommu_domain(domain);
+
+ flags = (prot & IOMMU_READ ? VIRTIO_IOMMU_MAP_F_READ : 0) |
+ (prot & IOMMU_WRITE ? VIRTIO_IOMMU_MAP_F_WRITE : 0) |
+ (prot & IOMMU_MMIO ? VIRTIO_IOMMU_MAP_F_MMIO : 0);
+
+ mapping = viommu_add_mapping(vdomain, iova, paddr, size, flags);
+ if (!mapping)
+ return -ENOMEM;
+
+ map = (struct virtio_iommu_req_map) {
+ .head.type = VIRTIO_IOMMU_T_MAP,
+ .domain = cpu_to_le32(vdomain->id),
+ .virt_...
2018 Oct 12
0
[PATCH v3 5/7] iommu: Add virtio-iommu driver
...phys_addr_t paddr, size_t size, int prot)
+{
+ int ret;
+ int flags;
+ struct viommu_mapping *mapping;
+ struct virtio_iommu_req_map map;
+ struct viommu_domain *vdomain = to_viommu_domain(domain);
+
+ flags = (prot & IOMMU_READ ? VIRTIO_IOMMU_MAP_F_READ : 0) |
+ (prot & IOMMU_WRITE ? VIRTIO_IOMMU_MAP_F_WRITE : 0) |
+ (prot & IOMMU_MMIO ? VIRTIO_IOMMU_MAP_F_MMIO : 0);
+
+ mapping = viommu_add_mapping(vdomain, iova, paddr, size, flags);
+ if (!mapping)
+ return -ENOMEM;
+
+ map = (struct virtio_iommu_req_map) {
+ .head.type = VIRTIO_IOMMU_T_MAP,
+ .domain = cpu_to_le32(vdomain->id),
+ .virt_...
2018 Feb 14
0
[PATCH 1/4] iommu: Add virtio-iommu driver
...int flags;
+ struct viommu_mapping *mapping;
+ struct viommu_domain *vdomain = to_viommu_domain(domain);
+
+ mapping = viommu_add_mapping(vdomain, iova, paddr, size);
+ if (!mapping)
+ return -ENOMEM;
+
+ flags = (prot & IOMMU_READ ? VIRTIO_IOMMU_MAP_F_READ : 0) |
+ (prot & IOMMU_WRITE ? VIRTIO_IOMMU_MAP_F_WRITE : 0);
+
+ mapping->req.map = (struct virtio_iommu_req_map) {
+ .head.type = VIRTIO_IOMMU_T_MAP,
+ .domain = cpu_to_le32(vdomain->id),
+ .virt_start = cpu_to_le64(iova),
+ .phys_start = cpu_to_le64(paddr),
+ .virt_end = cpu_to_le64(iova + size - 1),
+ .flags = cpu_to_le32(flags),
+ };...
2018 Nov 08
0
[PATCH v3 5/7] iommu: Add virtio-iommu driver
...t;> + int flags;
>> + struct viommu_mapping *mapping;
>> + struct virtio_iommu_req_map map;
>> + struct viommu_domain *vdomain = to_viommu_domain(domain);
>> +
>> + flags = (prot & IOMMU_READ ? VIRTIO_IOMMU_MAP_F_READ : 0) |
>> + (prot & IOMMU_WRITE ? VIRTIO_IOMMU_MAP_F_WRITE : 0) |
>> + (prot & IOMMU_MMIO ? VIRTIO_IOMMU_MAP_F_MMIO : 0);
>> +
>> + mapping = viommu_add_mapping(vdomain, iova, paddr, size, flags);
>> + if (!mapping)
>> + return -ENOMEM;
>> +
>> + map = (struct virtio_iommu_req_map) {
>> + .head.type =...
2019 May 30
10
[PATCH v8 0/7] Add virtio-iommu driver
Implement the virtio-iommu driver, following specification v0.12 [1].
Since last version [2] we've worked on improving the specification,
which resulted in the following changes to the interface:
* Remove the EXEC flag.
* Add feature bit for the MMIO flag.
* Change domain_bits to domain_range.
Given that there were small changes to patch 5/7, I removed the review
and test tags. Please find
2018 Nov 23
2
[PATCH v5 5/7] iommu: Add virtio-iommu driver
...hys_addr_t paddr, size_t size, int prot)
> +{
> + int ret;
> + int flags;
> + struct virtio_iommu_req_map map;
> + struct viommu_domain *vdomain = to_viommu_domain(domain);
> +
> + flags = (prot & IOMMU_READ ? VIRTIO_IOMMU_MAP_F_READ : 0) |
> + (prot & IOMMU_WRITE ? VIRTIO_IOMMU_MAP_F_WRITE : 0) |
> + (prot & IOMMU_MMIO ? VIRTIO_IOMMU_MAP_F_MMIO : 0);
> +
> + ret = viommu_add_mapping(vdomain, iova, paddr, size, flags);
> + if (ret)
> + return ret;
> +
> + map = (struct virtio_iommu_req_map) {
> + .head.type = VIRTIO_IOMMU_T_MAP,
> + .domain = cpu_to...