Skip to contentSkip to conversation

exec: Limit translation limiting in address_space_translate to xen

PATCH In review Alexey Kardashevskiy 3 participants 3 messages Mar 27, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 exec: Limit translation limiting in address_space_translate to xen

The address_space_translate() function cuts the returned plen (page size) to hardcoded TARGET_PAGE_SIZE. This function can be used on pages bigger than that so this limiting should not be used on such pages.

Since originally the limiting was introduced for XEN, we can safely limit this piece of code to XEN. So does the patch.

---

I need this change for VFIO-on-sPAPR series as it is going to support 16MB IOMMU pages. Thanks.

---
 exec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
exec.c +1 -1
index 91513c6..cf12049 100644
@@ -380,7 +380,7 @@ MemoryRegion *address_space_translate(AddressSpace *as, hwaddr addr,
         as = iotlb.target_as;
     }
 
-    if (memory_access_is_direct(mr, is_write)) {
+    if (xen_enabled() && memory_access_is_direct(mr, is_write)) {
         hwaddr page = ((addr & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE) - addr;
         len = MIN(page, len);
     }
Signature · 1 line
1.8.4.rc4
#1 lore raw

Il 27/03/2014 05:35, Alexey Kardashevskiy ha scritto:

Quoted 23 lines

The address_space_translate() function cuts the returned plen (page size) to hardcoded TARGET_PAGE_SIZE. This function can be used on pages bigger than that so this limiting should not be used on such pages.

Since originally the limiting was introduced for XEN, we can safely limit this piece of code to XEN. So does the patch.

---

I need this change for VFIO-on-sPAPR series as it is going to support 16MB IOMMU pages. Thanks.

---
 exec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
exec.c +0 -0
index 91513c6..cf12049 100644

exec.c MemoryRegion *address_space_translate(AddressSpace *as, hwaddr addr, · line 386

Quoted 8 lines
exec.c +1 -1
@@ -380,7 +380,7 @@ MemoryRegion *address_space_translate(AddressSpace *as, hwaddr addr,
         as = iotlb.target_as;
     }
 
-    if (memory_access_is_direct(mr, is_write)) {
+    if (xen_enabled() && memory_access_is_direct(mr, is_write)) {
         hwaddr page = ((addr & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE) - addr;
         len = MIN(page, len);
     }

Stefano, can you include this in your Xen tree for 2.1?

Paolo

#2 lore raw
Quoted 27 lines · Paolo Bonzini

Il 27/03/2014 05:35, Alexey Kardashevskiy ha scritto:

Quoted 26 lines

The address_space_translate() function cuts the returned plen (page size) to hardcoded TARGET_PAGE_SIZE. This function can be used on pages bigger than that so this limiting should not be used on such pages.

Since originally the limiting was introduced for XEN, we can safely limit this piece of code to XEN. So does the patch.

---

I need this change for VFIO-on-sPAPR series as it is going to support 16MB IOMMU pages. Thanks.

---
 exec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
exec.c +0 -0
index 91513c6..cf12049 100644
@@ -380,7 +380,7 @@ MemoryRegion *address_space_translate(AddressSpace *as,
 hwaddr addr,
         as = iotlb.target_as;
     }
 
Quoted 9 lines
Quoted 7 lines
exec.c +1 -1
-    if (memory_access_is_direct(mr, is_write)) {
+    if (xen_enabled() && memory_access_is_direct(mr, is_write)) {
         hwaddr page = ((addr & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE) -
 addr;
         len = MIN(page, len);
     }

Stefano, can you include this in your Xen tree for 2.1?

Sure.