s390x: css: pv: css test adaptation for PV
v5 cover s390x: css: pv: css test adaptation for PV
Hi all,
To adapt the CSS I/O tests to protected virtualisation we need utilities to:
1- allocate the I/O buffers in a private page using (patch 2)
It must be in a dedicated page to avoid exporting code or guest private data to the host.
We accept a size in byte and flags and allocate page integral memory to handle the Protected Virtualization.
2- share the I/O buffers with the host (patch 1)
This patch uses the page allocator reworked by Claudio.
The 2 first patches are the implementation of the tools, patch 3 is the modification of the css.c test for PV.
The checkpatch always asked me to modify MAINTAINERS, so I added me as reviewer to be in copy for CSS at least. May be we could create a finer grain MAINTAINERS in the future.
regards,
Pierre
Pierre Morel (3):
s390x: pv: implement routine to share/unshare memory
s390x: define UV compatible I/O allocation
s390x: css: pv: css test adaptation for PV
lib/s390x/asm/uv.h | 39 ++++++++++++++++++++++++ lib/s390x/css.h | 3 +- lib/s390x/css_lib.c | 28 +++++------------ lib/s390x/malloc_io.c | 71 +++++++++++++++++++++++++++++++++++++++++++ lib/s390x/malloc_io.h | 45 +++++++++++++++++++++++++++ s390x/Makefile | 1 + s390x/css.c | 43 ++++++++++++++++++-------- 7 files changed, 196 insertions(+), 34 deletions(-) create mode 100644 lib/s390x/malloc_io.c create mode 100644 lib/s390x/malloc_io.h
Signature · 53 lines
2.17.1 changelog: from v4: - better SPDX license (Thomast, Janosch) - use get_order instead of a false calculation (Thomas) - rename functions malloc_io_pages to malloc_io_mem (Thomas) - Explicit error sentence for share errors (Janosch) - use UVC_RC_EXECUTED instead of bare hexa in share (Janosch) - removed MAINTAINERS changes, will be in another patch if ever (Janosch, Thomas) from v3: - add failure report to the new allocations in css.c (Thomas) - rework alloc_io_page and free_io_page (Thomas, Claudio) - add SPDX licenses (Thomas) - add comment for the functions declaration. - add me as reviewer for the CSS from v2: - use the page allocator reworked by Claudio from v1: - add the kvm-unit-test header - correct checks for errors on Set/Remove Shared Access - Add report for uv Set/Remove Shared Access - zero the allocated I/O page before use - free the page on error.
PATCH v5 1/3 s390x: pv: implement routine to share/unshare memory
When communicating with the host we need to share part of the memory.
Let's implement the ultravisor calls for this.
--- lib/s390x/asm/uv.h | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+)
lib/s390x/asm/uv.h +39 -0
@@ -79,4 +79,43 @@ static inline int uv_call(unsigned long r1, unsigned long r2)return cc; } +static inline int share (unsigned long addr,u16 cmd) +{ +struct uv_cb_share uvcb = { + .header.cmd = cmd, + .header.len =sizeof (uvcb), + .paddr = addr + }; +int cc; + + cc =uv_call (0 , (u64)&uvcb); +if (!cc && uvcb.header.rc ==UVC_RC_EXECUTED ) +return 0 ; + +report_info ("uv_call: cmd %04x cc %d response code: %04x" , cc, cmd, + uvcb.header.rc); +return -1 ; +} + +/* +* Guest 2 request to the Ultravisor to make a page shared with the +* hypervisor for IO. +* +* @addr: Real or absolute address of the page to be shared +*/ +static inline int uv_set_shared (unsigned long addr) +{ +return share (addr,UVC_CMD_SET_SHARED_ACCESS ); +} + +/* +* Guest 2 request to the Ultravisor to make a page unshared. +* +* @addr: Real or absolute address of the page to be unshared +*/ +static inline int uv_remove_shared (unsigned long addr) +{ +return share (addr,UVC_CMD_REMOVE_SHARED_ACCESS ); +} +#endif
Signature · 1 line
2.17.1
Re: [kvm-unit-tests PATCH v5 1/3] s390x: pv: implement routine to share/unshare memory
Quoted 4 lines · Pierre Morel
When communicating with the host we need to share part of the memory.
Let's implement the ultravisor calls for this.
Quoted 58 lines
Signed-off-by Pierre Morel <[email protected]>Suggested-by Janosch Frank <[email protected]>Acked-by Cornelia Huck <[email protected]>Acked-by Thomas Huth <[email protected]>--- lib/s390x/asm/uv.h | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+)lib/s390x/asm/uv.h +39
-0@@ -79,4 +79,43 @@ static inline int uv_call(unsigned long r1, unsigned long r2)return cc; } +static inline int share (unsigned long addr,u16 cmd) +{ +struct uv_cb_share uvcb = { + .header.cmd = cmd, + .header.len =sizeof (uvcb), + .paddr = addr + }; +int cc; + + cc =uv_call (0 , (u64)&uvcb); +if (!cc && uvcb.header.rc ==UVC_RC_EXECUTED ) +return 0 ; + +report_info ("uv_call: cmd %04x cc %d response code: %04x" , cc, cmd, + uvcb.header.rc); +return -1 ; +} + +/* +* Guest 2 request to the Ultravisor to make a page shared with the +* hypervisor for IO. +* +* @addr: Real or absolute address of the page to be shared +*/ +static inline int uv_set_shared (unsigned long addr) +{ +return share (addr,UVC_CMD_SET_SHARED_ACCESS ); +} + +/* +* Guest 2 request to the Ultravisor to make a page unshared. +* +* @addr: Real or absolute address of the page to be unshared +*/ +static inline int uv_remove_shared (unsigned long addr) +{ +return share (addr,UVC_CMD_REMOVE_SHARED_ACCESS ); +} +#endif
Re: [kvm-unit-tests PATCH v5 1/3] s390x: pv: implement routine to share/unshare memory
Quoted 7 lines · Janosch Frank
Quoted 4 lines · Pierre Morel
When communicating with the host we need to share part of the memory.
Let's implement the ultravisor calls for this.
Reviewed-by Janosch Frank <[email protected]>
Thanks,
Pierre
...snip...
Signature · 2 lines
Pierre Morel IBM Lab Boeblingen
PATCH v5 2/3 s390x: define UV compatible I/O allocation
In reply to Pierre MorelTo centralize the memory allocation for I/O we define the alloc_io_mem/free_io_mem functions which share the I/O memory with the host in case the guest runs with protected virtualization.
These functions allocate on a page integral granularity to ensure a dedicated sharing of the allocated objects.
--- lib/s390x/malloc_io.c | 71 +++++++++++++++++++++++++++++++++++++++++++ lib/s390x/malloc_io.h | 45 +++++++++++++++++++++++++++ s390x/Makefile | 1 + 3 files changed, 117 insertions(+) create mode 100644 lib/s390x/malloc_io.c create mode 100644 lib/s390x/malloc_io.h
lib/s390x/malloc_io.c new file +71 -0
@@ -0,0 +1,71 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* I/O page allocation +* +* Copyright (c) 2021 IBM Corp +* +* Authors: +* Pierre Morel <[email protected]> +* +* Using this interface provide host access to the allocated pages in +* case the guest is a secure guest. +* This is needed for I/O buffers. +* +*/ +#include <libcflat.h> +#include <asm/page.h> +#include <asm/uv.h> +#include <malloc_io.h> +#include <alloc_page.h> +#include <asm/facility.h> +#include <bitops.h> + +static int share_pages (void *p,int count) +{ +int i =0 ; + +for (i =0 ; i < count; i++, p +=PAGE_SIZE ) +if (uv_set_shared ((unsigned long )p)) +break ; +return i; +} + +static void unshare_pages (void *p,int count) +{ +int i; + +for (i = count; i >0 ; i--, p +=PAGE_SIZE ) +uv_remove_shared ((unsigned long )p); +} + +void *alloc_io_mem (int size,int flags) +{ +int order =get_order (size >>PAGE_SHIFT ); +void *p; +int n; + +assert (size); + + p =alloc_pages_flags (order,AREA_DMA31 | flags); +if (!p || !test_facility (158 )) +return p; + + n =share_pages (p,1 << order); +if (n ==1 << order) +return p; + +unshare_pages (p, n); +free_pages (p); +return NULL ; +} + +void free_io_mem (void *p,int size) +{ +int order =get_order (size >>PAGE_SHIFT ); + +assert (IS_ALIGNED ((uintptr_t )p,PAGE_SIZE )); + +if (test_facility (158 )) +unshare_pages (p,1 << order); +free_pages (p); +}
lib/s390x/malloc_io.h new file +45 -0
45 lines not on this page · raw message
s390x/Makefile +1 -0
@@ -64,6 +64,7 @@ cflatobjs += lib/s390x/smp.o cflatobjs += lib/s390x/vm.o cflatobjs += lib/s390x/css_dump.o cflatobjs += lib/s390x/css_lib.o +cflatobjs += lib/s390x/malloc_io.o OBJDIRS += lib/s390x
Signature · 1 line
2.17.1
Re: [kvm-unit-tests PATCH v5 2/3] s390x: define UV compatible I/O allocation
Quoted 9 lines · Pierre Morel
To centralize the memory allocation for I/O we define the alloc_io_mem/free_io_mem functions which share the I/O memory with the host in case the guest runs with protected virtualization.
These functions allocate on a page integral granularity to ensure a dedicated sharing of the allocated objects.
Signed-off-by Pierre Morel <[email protected]>
Quoted 15 lines
--- lib/s390x/malloc_io.c | 71 +++++++++++++++++++++++++++++++++++++++++++ lib/s390x/malloc_io.h | 45 +++++++++++++++++++++++++++ s390x/Makefile | 1 + 3 files changed, 117 insertions(+) create mode 100644 lib/s390x/malloc_io.c create mode 100644 lib/s390x/malloc_io.hlib/s390x/malloc_io.c new file +1
-0@@ -0,0 +1,71 @@ +/* SPDX-License-Identifier: GPL-2.0-only */
lib/s390x/malloc_io.c line 11
Quoted 10 lines
lib/s390x/malloc_io.c new file +10
-0+/* +* I/O page allocation +* +* Copyright (c) 2021 IBM Corp +* +* Authors: +* Pierre Morel <[email protected]> +* +* Using this interface provide host access to the allocated pages in +* case the guest is a secure guest.
s/secure/protected/
Quoted 28 lines
lib/s390x/malloc_io.c new file +28
-0+* This is needed for I/O buffers. +* +*/ +#include <libcflat.h> +#include <asm/page.h> +#include <asm/uv.h> +#include <malloc_io.h> +#include <alloc_page.h> +#include <asm/facility.h> +#include <bitops.h> + +static int share_pages (void *p,int count) +{ +int i =0 ; + +for (i =0 ; i < count; i++, p +=PAGE_SIZE ) +if (uv_set_shared ((unsigned long )p)) +break ; +return i; +} + +static void unshare_pages (void *p,int count) +{ +int i; + +for (i = count; i >0 ; i--, p +=PAGE_SIZE ) +uv_remove_shared ((unsigned long )p); +}
lib/s390x/malloc_io.c line 49
Quoted 10 lines
lib/s390x/malloc_io.c new file +10
-0+ +void *alloc_io_mem (int size,int flags) +{ +int order =get_order (size >>PAGE_SHIFT ); +void *p; +int n; + +assert (size); + + p =alloc_pages_flags (order,AREA_DMA31 | flags);
Pardon my lack of IO knowledge but do we also need to restrict the data to below 2g or only the IO control structures?
Not that it currently matters much for a unit test with 256mb of memory...
Quoted 36 lines
lib/s390x/malloc_io.c new file +22
-0+if (!p || !test_facility (158 )) +return p; + + n =share_pages (p,1 << order); +if (n ==1 << order) +return p; + +unshare_pages (p, n); +free_pages (p); +return NULL ; +} + +void free_io_mem (void *p,int size) +{ +int order =get_order (size >>PAGE_SHIFT ); + +assert (IS_ALIGNED ((uintptr_t )p,PAGE_SIZE )); + +if (test_facility (158 )) +unshare_pages (p,1 << order); +free_pages (p); +}lib/s390x/malloc_io.h new file +8
-0@@ -0,0 +1,45 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* I/O allocations +* +* Copyright (c) 2021 IBM Corp +* +* Authors: +* Pierre Morel <[email protected]>
lib/s390x/malloc_io.h line 18
Quoted 10 lines
lib/s390x/malloc_io.h new file +10
-0+* +*/ +#ifndef _S390X_MALLOC_IO_H_ +#define _S390X_MALLOC_IO_H_ + +/* +* Allocates a page aligned page bound range of contiguous real or +* absolute memory in the DMA31 region large enough to contain size +* bytes. +* If Protected Virtualisation facility is present, shares the pages
s/Virtualisation/Virtualization/
But I can fix this and the nitpick above up when picking.
Quoted 40 lines
lib/s390x/malloc_io.h new file +27
-0+* with the host. +* If all the pages for the specified size cannot be reserved, +* the function rewinds the partial allocation and a NULL pointer +* is returned. +* +* @size: the minimal size allocated in byte. +* @flags: the flags used for the underlying page allocator. +* +* Errors: +* The allocation will assert the size parameter, will fail if the +* underlying page allocator fail or in the case of protected +* virtualisation if the sharing of the pages fails. +* +* Returns a pointer to the first page in case of success, NULL otherwise. +*/ +void *alloc_io_mem (int size,int flags); + +/* +* Frees a previously memory space allocated by alloc_io_mem. +* If Protected Virtualisation facility is present, unshares the pages +* with the host. +* The address must be aligned on a page boundary otherwise an assertion +* breaks the program. +*/ +void free_io_mem (void *p,int size); + +#endif /* _S390X_MALLOC_IO_H_ */ s390x/Makefile +1
-0@@ -64,6 +64,7 @@ cflatobjs += lib/s390x/smp.o cflatobjs += lib/s390x/vm.o cflatobjs += lib/s390x/css_dump.o cflatobjs += lib/s390x/css_lib.o +cflatobjs += lib/s390x/malloc_io.o OBJDIRS += lib/s390x
Re: [kvm-unit-tests PATCH v5 2/3] s390x: define UV compatible I/O allocation
Quoted 32 lines · Janosch Frank
Quoted 9 lines · Pierre Morel
To centralize the memory allocation for I/O we define the alloc_io_mem/free_io_mem functions which share the I/O memory with the host in case the guest runs with protected virtualization.
These functions allocate on a page integral granularity to ensure a dedicated sharing of the allocated objects.
Signed-off-by Pierre Morel <[email protected]>Acked-by Janosch Frank <[email protected]>Quoted 19 lines
--- lib/s390x/malloc_io.c | 71 +++++++++++++++++++++++++++++++++++++++++++ lib/s390x/malloc_io.h | 45 +++++++++++++++++++++++++++ s390x/Makefile | 1 + 3 files changed, 117 insertions(+)create mode 100644
lib/s390x/malloc_io.c
create mode 100644lib/s390x/malloc_io.hlib/s390x/malloc_io.c new file +5
-0@@ -0,0 +1,71 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* I/O page allocation +* +* Copyright (c) 2021 IBM Corp
Quoted 8 lines
lib/s390x/malloc_io.c line 11
Quoted 6 lines
lib/s390x/malloc_io.c new file +6
-0+* +* Authors: +* Pierre Morel <[email protected]> +* +* Using this interface provide host access to the allocated pages in +* case the guest is a secure guest. s/secure/protected/
OK
Quoted 43 lines
Quoted 29 lines
lib/s390x/malloc_io.c new file +28
-0+* This is needed for I/O buffers. +* +*/ +#include <libcflat.h> +#include <asm/page.h> +#include <asm/uv.h> +#include <malloc_io.h> +#include <alloc_page.h> +#include <asm/facility.h> +#include <bitops.h> + +static int share_pages (void *p,int count) +{ +int i =0 ; + +for (i =0 ; i < count; i++, p +=PAGE_SIZE ) +if (uv_set_shared ((unsigned long )p)) +break ; +return i; +} + +static void unshare_pages (void *p,int count) +{ +int i; + +for (i = count; i >0 ; i--, p +=PAGE_SIZE ) +uv_remove_shared ((unsigned long )p); +}lib/s390x/malloc_io.c line 49
Quoted 10 lines
lib/s390x/malloc_io.c new file +10
-0+ +void *alloc_io_mem (int size,int flags) +{ +int order =get_order (size >>PAGE_SHIFT ); +void *p; +int n; + +assert (size); + + p =alloc_pages_flags (order,AREA_DMA31 | flags);Pardon my lack of IO knowledge but do we also need to restrict the data to below 2g or only the IO control structures?
Quoted 1 line
Not that it currently matters much for a unit test with 256mb of memory...
it depends, if you know how work most scatter-gather it is easy:
INSTR-> ORB -> CCW -> DATA
first level metadata: yes
- Intruction point with 31bit to ORB
- ORB point with 31b to CCW
- CCW point with 31b to data
first level of data, the one pointed by the CCW: yes
This is all what is used in this patch.
To be developed in the future:
INSTR-> ORB -> CCW -> [M]IDA -> DATA
second level metadata:
they are pointed to by CCW...
- IDA : yes
- MIDA: yes
second level data (indirect buffering)
- IDA format 1: 31b address: yes
- IDA format 2: 64b address: no
- MIDA : 64b address: no
Or to sum up only data accessed with indirect addressing by IDA format 2 and MIDA can be anywhere.
Quoted 50 lines
Quoted 37 lines
lib/s390x/malloc_io.c new file +22
-0+if (!p || !test_facility (158 )) +return p; + + n =share_pages (p,1 << order); +if (n ==1 << order) +return p; + +unshare_pages (p, n); +free_pages (p); +return NULL ; +} + +void free_io_mem (void *p,int size) +{ +int order =get_order (size >>PAGE_SHIFT ); + +assert (IS_ALIGNED ((uintptr_t )p,PAGE_SIZE )); + +if (test_facility (158 )) +unshare_pages (p,1 << order); +free_pages (p); +}lib/s390x/malloc_io.h new file +8
-0@@ -0,0 +1,45 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* I/O allocations +* +* Copyright (c) 2021 IBM Corp +* +* Authors: +* Pierre Morel <[email protected]> lib/s390x/malloc_io.h line 18
Quoted 10 lines
lib/s390x/malloc_io.h new file +10
-0+* +*/ +#ifndef _S390X_MALLOC_IO_H_ +#define _S390X_MALLOC_IO_H_ + +/* +* Allocates a page aligned page bound range of contiguous real or +* absolute memory in the DMA31 region large enough to contain size +* bytes. +* If Protected Virtualisation facility is present, shares the pages s/Virtualisation/Virtualization/
Quoted 1 line
But I can fix this and the nitpick above up when picking.
:) Thomas made me change this in the last round.
As far as I know "z" is used in the uS ans "s" in England (and France).
regards,
Pierre
Signature · 2 lines
Pierre Morel IBM Lab Boeblingen
Re: [kvm-unit-tests PATCH v5 2/3] s390x: define UV compatible I/O allocation
In reply to Pierre MorelQuoted 8 lines · Pierre Morel
To centralize the memory allocation for I/O we define the alloc_io_mem/free_io_mem functions which share the I/O memory with the host in case the guest runs with protected virtualization.
These functions allocate on a page integral granularity to ensure a dedicated sharing of the allocated objects.
Quoted 8 lines
Signed-off-by Pierre Morel <[email protected]>--- lib/s390x/malloc_io.c | 71 +++++++++++++++++++++++++++++++++++++++++++ lib/s390x/malloc_io.h | 45 +++++++++++++++++++++++++++ s390x/Makefile | 1 + 3 files changed, 117 insertions(+)create mode 100644
lib/s390x/malloc_io.c
create mode 100644lib/s390x/malloc_io.h
Re: [kvm-unit-tests PATCH v5 2/3] s390x: define UV compatible I/O allocation
Quoted 18 lines · Thomas Huth
Quoted 8 lines · Pierre Morel
To centralize the memory allocation for I/O we define the alloc_io_mem/free_io_mem functions which share the I/O memory with the host in case the guest runs with protected virtualization.
These functions allocate on a page integral granularity to ensure a dedicated sharing of the allocated objects.
Quoted 8 lines
Signed-off-by Pierre Morel <[email protected]>---
lib/s390x/malloc_io.c| 71 +++++++++++++++++++++++++++++++++++++++++++lib/s390x/malloc_io.h| 45 +++++++++++++++++++++++++++ s390x/Makefile | 1 +3 files changed, 117 insertions(+)create mode 100644
lib/s390x/malloc_io.c
create mode 100644lib/s390x/malloc_io.h
Quoted 2 lines
Acked-by Thomas Huth <[email protected]>
Thanks,
Pierre
Signature · 2 lines
Pierre Morel IBM Lab Boeblingen
Re: [kvm-unit-tests PATCH v5 2/3] s390x: define UV compatible I/O allocation
In reply to Pierre MorelQuoted 8 lines · On Fri, 22 Jan 2021 14:27:39 +0100 Pierre Morel <[email protected]> wrote:
To centralize the memory allocation for I/O we define the alloc_io_mem/free_io_mem functions which share the I/O memory with the host in case the guest runs with protected virtualization.
These functions allocate on a page integral granularity to ensure a dedicated sharing of the allocated objects.
Quoted 8 lines
Signed-off-by Pierre Morel <[email protected]>--- lib/s390x/malloc_io.c | 71 +++++++++++++++++++++++++++++++++++++++++++ lib/s390x/malloc_io.h | 45 +++++++++++++++++++++++++++ s390x/Makefile | 1 + 3 files changed, 117 insertions(+) create mode 100644 lib/s390x/malloc_io.c create mode 100644 lib/s390x/malloc_io.h
Re: [kvm-unit-tests PATCH v5 2/3] s390x: define UV compatible I/O allocation
Quoted 20 lines · Cornelia Huck
Quoted 8 lines · On Fri, 22 Jan 2021 14:27:39 +0100 Pierre Morel <[email protected]> wrote:
To centralize the memory allocation for I/O we define the alloc_io_mem/free_io_mem functions which share the I/O memory with the host in case the guest runs with protected virtualization.
These functions allocate on a page integral granularity to ensure a dedicated sharing of the allocated objects.
Quoted 8 lines
Signed-off-by Pierre Morel <[email protected]>--- lib/s390x/malloc_io.c | 71 +++++++++++++++++++++++++++++++++++++++++++ lib/s390x/malloc_io.h | 45 +++++++++++++++++++++++++++ s390x/Makefile | 1 + 3 files changed, 117 insertions(+)create mode 100644
lib/s390x/malloc_io.c
create mode 100644lib/s390x/malloc_io.h
Quoted 2 lines
Reviewed-by Cornelia Huck <[email protected]>
Thanks,
Pierre
Signature · 2 lines
Pierre Morel IBM Lab Boeblingen
PATCH v5 3/3 s390x: css: pv: css test adaptation for PV
In reply to Pierre MorelWe want the tests to automatically work with or without protected virtualisation.
To do this we need to share the I/O memory with the host.
Let's replace all static allocations with dynamic allocations to clearly separate shared and private memory.
--- lib/s390x/css.h | 3 +-- lib/s390x/css_lib.c | 28 ++++++++-------------------- s390x/css.c | 43 +++++++++++++++++++++++++++++++------------ 3 files changed, 40 insertions(+), 34 deletions(-)
lib/s390x/css.h +1 -2
@@ -281,8 +281,7 @@ int css_enable(int schid, int isc);/* Library functions */ int start_ccw1_chain (unsigned int sid,struct ccw1 *ccw); -int start_single_ccw (unsigned int sid,int code,void *data,int count, -unsigned char flags); +struct ccw1 *ccw_alloc (int code,void *data,int count,unsigned char flags);void css_irq_io (void );int css_residual_count (unsigned int schid);
lib/s390x/css_lib.c +8 -20
@@ -16,6 +16,7 @@#include <asm/time.h> #include <asm/arch_def.h> +#include <malloc_io.h> #include <css.h> static struct schib schib;
@@ -200,33 +201,20 @@ int start_ccw1_chain(unsigned int sid, struct ccw1 *ccw)return ssch (sid, &orb); } -/* -* In the future, we want to implement support for CCW chains; -* for that, we will need to work with ccw1 pointers. -*/ -static struct ccw1 unique_ccw; - -int start_single_ccw (unsigned int sid,int code,void *data,int count, -unsigned char flags) +struct ccw1 *ccw_alloc (int code,void *data,int count,unsigned char flags) { -int cc; -struct ccw1 *ccw = &unique_ccw; +struct ccw1 *ccw; + + ccw =alloc_io_mem (sizeof (*ccw),0 ); +if (!ccw) +return NULL ; -report_prefix_push ("start_subchannel" ); -/* Build the CCW chain with a single CCW */ ccw->code = code; ccw->flags = flags; ccw->count = count; ccw->data_address = (int )(unsigned long )data; - cc =start_ccw1_chain (sid, ccw); -if (cc) { -report (0 ,"cc = %d" , cc); -report_prefix_pop (); -return cc; - } -report_prefix_pop (); -return 0 ; +return ccw; }/* wait_and_check_io_completion:
s390x/css.c +31 -12
89 lines not on this page · raw message
Signature · 1 line
2.17.1
Quoted 17 lines · Pierre Morel
Hi all,
To adapt the CSS I/O tests to protected virtualisation we need utilities to:
1- allocate the I/O buffers in a private page using (patch 2)
It must be in a dedicated page to avoid exporting code or guest private data to the host.
We accept a size in byte and flags and allocate page integral memory to handle the Protected Virtualization.2- share the I/O buffers with the host (patch 1)
This patch uses the page allocator reworked by Claudio.The 2 first patches are the implementation of the tools, patch 3 is the modification of the
css.ctest for PV.
Quoted 7 lines
The checkpatch always asked me to modify
MAINTAINERS, so I added me as reviewer to be in copy for CSS at least. May be we could create a finer grainMAINTAINERSin the future.regards,
Pierre
Thanks, picked.
Quoted 18 lines
Pierre Morel (3):
s390x: pv: implement routine to share/unshare memory
s390x: define UV compatible I/O allocation
s390x: css: pv: css test adaptation for PVlib/s390x/asm/uv.h | 39 ++++++++++++++++++++++++ lib/s390x/css.h | 3 +- lib/s390x/css_lib.c | 28 +++++------------ lib/s390x/malloc_io.c | 71 +++++++++++++++++++++++++++++++++++++++++++ lib/s390x/malloc_io.h | 45 +++++++++++++++++++++++++++ s390x/Makefile | 1 + s390x/css.c | 43 ++++++++++++++++++-------- 7 files changed, 196 insertions(+), 34 deletions(-) create mode 100644 lib/s390x/malloc_io.c create mode 100644 lib/s390x/malloc_io.h
Quoted 23 lines · Janosch Frank
Quoted 22 lines · Pierre Morel
Hi all,
To adapt the CSS I/O tests to protected virtualisation we need utilities to:
1- allocate the I/O buffers in a private page using (patch 2)
It must be in a dedicated page to avoid exporting code or guest private data to the host.
We accept a size in byte and flags and allocate page integral memory to handle the Protected Virtualization.2- share the I/O buffers with the host (patch 1)
This patch uses the page allocator reworked by Claudio.The 2 first patches are the implementation of the tools, patch 3 is the modification of the
css.ctest for PV.The checkpatch always asked me to modify
MAINTAINERS, so I added me as reviewer to be in copy for CSS at least. May be we could create a finer grainMAINTAINERSin the future.
Quoted 4 lines
Quoted 2 lines
regards,
PierreThanks, picked.
Thanks,
Pierre
Signature · 2 lines
Pierre Morel IBM Lab Boeblingen