x86/hvm: separate ioreq server code from generic hvm code
PATCH v2 1/1 x86/hvm: separate ioreq server code from generic hvm code
The code in hvm/hvm.c related to handling I/O emulation using the ioreq server framework is large and mostly self-contained.
This patch separates the ioreq server code into a new hvm/ioreq.c source module and accompanying asm-x86/hvm/ioreq.h header file. There is no intended functional change, only code movement.
---
v2:
- Fixed copyright in ioreq.h boilerplate.
--- xen/arch/x86/hvm/Makefile | 1 + xen/arch/x86/hvm/emulate.c | 1 + xen/arch/x86/hvm/hvm.c | 1461 ++------------------------------------- xen/arch/x86/hvm/io.c | 1 + xen/arch/x86/hvm/ioreq.c | 1375 ++++++++++++++++++++++++++++++++++++ xen/arch/x86/hvm/stdvga.c | 1 + xen/arch/x86/hvm/vmx/vvmx.c | 1 + xen/include/asm-x86/hvm/hvm.h | 7 - xen/include/asm-x86/hvm/ioreq.h | 66 ++ 9 files changed, 1521 insertions(+), 1393 deletions(-) create mode 100644 xen/arch/x86/hvm/ioreq.c create mode 100644 xen/include/asm-x86/hvm/ioreq.h
xen/arch/x86/hvm/Makefile +1 -0
@@ -9,6 +9,7 @@ obj-y += hvm.o obj-y += i8254.o obj-y += intercept.o obj-y += io.o +obj-y += ioreq.o obj-y += irq.o obj-y += mtrr.o obj-y += nestedhvm.o
xen/arch/x86/hvm/emulate.c +1 -0
@@ -19,6 +19,7 @@#include <asm/xstate.h> #include <asm/hvm/emulate.h> #include <asm/hvm/hvm.h> +#include <asm/hvm/ioreq.h> #include <asm/hvm/trace.h> #include <asm/hvm/support.h> #include <asm/hvm/svm/svm.h>
xen/arch/x86/hvm/hvm.c +75 -1386
1,520 lines not on this page · raw message
xen/arch/x86/hvm/io.c +1 -0
@@ -35,6 +35,7 @@#include <asm/shadow.h> #include <asm/p2m.h> #include <asm/hvm/hvm.h> +#include <asm/hvm/ioreq.h> #include <asm/hvm/support.h> #include <asm/hvm/vpt.h> #include <asm/hvm/vpic.h>
xen/arch/x86/hvm/ioreq.c new file +1375 -0
1,375 lines not on this page · raw message
xen/arch/x86/hvm/stdvga.c +1 -0
@@ -31,6 +31,7 @@#include <xen/types.h> #include <xen/sched.h> #include <xen/domain_page.h> +#include <asm/hvm/ioreq.h> #include <asm/hvm/support.h> #include <xen/numa.h> #include <xen/paging.h>
xen/arch/x86/hvm/vmx/vvmx.c +1 -0
@@ -23,6 +23,7 @@#include <asm/types.h> #include <asm/mtrr.h> #include <asm/p2m.h> +#include <asm/hvm/ioreq.h> #include <asm/hvm/vmx/vmx.h> #include <asm/hvm/vmx/vvmx.h> #include <asm/hvm/nestedhvm.h>
xen/include/asm-x86/hvm/hvm.h +0 -7
@@ -25,7 +25,6 @@#include <asm/hvm/asid.h> #include <public/domctl.h> #include <public/hvm/save.h> -#include <public/hvm/ioreq.h> #include <xen/mm.h> #ifndef NDEBUG
@@ -257,11 +256,6 @@ int hvm_vcpu_cacheattr_init(struct vcpu *v);void hvm_vcpu_cacheattr_destroy (struct vcpu *v);void hvm_vcpu_reset_state (struct vcpu *v,uint16_t cs,uint16_t ip); -struct hvm_ioreq_server *hvm_select_ioreq_server (struct domain *d, -ioreq_t *p); -int hvm_send_ioreq (struct hvm_ioreq_server *s,ioreq_t *p,bool_t buffered); -unsigned int hvm_broadcast_ioreq (ioreq_t *p,bool_t buffered); -void hvm_get_guest_pat (struct vcpu *v,u64 *guest_pat);int hvm_set_guest_pat (struct vcpu *v,u64 guest_pat);
@@ -411,7 +405,6 @@ void hvm_hypervisor_cpuid_leaf(uint32_t sub_idx,void hvm_cpuid (unsigned int input,unsigned int *eax,unsigned int *ebx,unsigned int *ecx,unsigned int *edx);void hvm_migrate_timers (struct vcpu *v); -bool_t hvm_io_pending (struct vcpu *v);void hvm_do_resume (struct vcpu *v);void hvm_migrate_pirqs (struct vcpu *v);
xen/include/asm-x86/hvm/ioreq.h new file +66 -0
45 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Part of the diff is not shown here. View the raw message.
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 01.04.16 at 09:54, <[email protected]> wrote:
The code in
hvm/hvm.crelated to handling I/O emulation using the ioreq server framework is large and mostly self-contained.This patch separates the ioreq server code into a new
hvm/ioreq.csource module and accompanyingasm-x86/hvm/ioreq.hheader file. There is no intended functional change, only code movement.
Considering how badly the diff gets represented, I can only trust you on that.
Quoted 1 line
Signed-off-by Paul Durrant <[email protected]>
But as indicated on IRC already, Wei will need to give his okay, as this is something that didn't get posted prior to the feature freeze date.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Wei Liu
Acked-byQuoted 11 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 01.04.16 at 09:54, <[email protected]> wrote:
The code in
hvm/hvm.crelated to handling I/O emulation using the ioreq server framework is large and mostly self-contained.This patch separates the ioreq server code into a new
hvm/ioreq.csource module and accompanyingasm-x86/hvm/ioreq.hheader file. There is no intended functional change, only code movement.Considering how badly the diff gets represented, I can only trust you on that.
Quoted 8 lines
Quoted 1 line
Signed-off-by Paul Durrant <[email protected]>Acked-by Jan Beulich <[email protected]>But as indicated on IRC already, Wei will need to give his okay, as this is something that didn't get posted prior to the feature freeze date.
Not a new feature by my definition, so I don't object to this. This needs to be applied as soon as possible though so that OSSTest can catch any issue.
Wei.
Quoted 2 lines
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 01.04.16 at 09:54, <[email protected]> wrote:
The code in
hvm/hvm.crelated to handling I/O emulation using the ioreq server framework is large and mostly self-contained.This patch separates the ioreq server code into a new
hvm/ioreq.csource module and accompanyingasm-x86/hvm/ioreq.hheader file. There is no intended functional change, only code movement.Signed-off-by Paul Durrant <[email protected]>
Please also provide an update to ./MAINTAINERS.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 13 lines
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: 01 April 2016 15:35
To: Paul Durrant
Cc: Andrew Cooper; Jun Nakajima; [email protected]; Keir (Xen.org)
Subject: Re: [PATCH v2] x86/hvm: separate ioreq server code from generic hvm codeQuoted 4 lines
Quoted 1 line
Quoted 1 line · On 01.04.16 at 09:54, <[email protected]> wrote:
The code in
hvm/hvm.crelated to handling I/O emulation using the ioreq server framework is large and mostly self-contained.
Quoted 8 lines
Quoted 5 lines
This patch separates the ioreq server code into a new
hvm/ioreq.csource module and accompanyingasm-x86/hvm/ioreq.hheader file. There is no intended functional change, only code movement.Signed-off-by Paul Durrant <[email protected]>Please also provide an update to ./MAINTAINERS.
Done, and posted.
Paul
Quoted 1 line
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 6 lines · Paul Durrant
The code in
hvm/hvm.crelated to handling I/O emulation using the ioreq server framework is large and mostly self-contained.This patch separates the ioreq server code into a new
hvm/ioreq.csource module and accompanyingasm-x86/hvm/ioreq.hheader file. There is no intended functional change, only code movement.
This may be more than just code movement. It breaks PVH. I haven't looked at what exactly is breaking but I figured I'd give a heads-up.
-boris
(XEN) ----[ Xen-4.7-unstable x86_64 debug=y Tainted: C ]----
(XEN) CPU: 2
(XEN) RIP: e008:[<ffff82d0801dac82>] handle_hvm_io_completion+0x1bb/0x288
(XEN) RFLAGS: 0000000000010286 CONTEXT: hypervisor (d1v0)
(XEN) rax: ffff8302453b8000 rbx: ffff8300a56e3000 rcx: ffff8302453bffc0 (XEN) rdx: ffff83024da8b000 rsi: ffff82d080326280 rdi: ffff8300a56e3000 (XEN) rbp: ffff8302453bfd80 rsp: ffff8302453bfc20 r8: ffff830247180ed0 (XEN) r9: 00000000ffffff21 r10: 00000000deadbeef r11: 0000000000000246 (XEN) r12: ffff8300a56e3000 r13: 0000000000000000 r14: ffff83024da8b250 (XEN) r15: ffff8302453f3000 cr0: 000000008005003b cr4: 00000000001526e0 (XEN) cr3: 000000024db49000 cr2: 0000000000000000
(XEN) ds: 002b es: 002b fs: 0000 gs: 0000 ss: e010 cs: e008
(XEN) Xen code around <ffff82d0801dac82> (handle_hvm_io_completion+0x1bb/0x288):
(XEN) 00 94 fe ff ff 4d 8b 6d <00> 8b 45 00 0f 18 08 4d 39 f5 0f 85 73 fe ff ff (XEN) Xen stack trace from rsp=ffff8302453bfc20:
(XEN) ffff8302453b8000 ffff8302453bfc30 0000000000000000 0000000000000000 (XEN) 0000000000000000 ffff8302453bfc88 00000000001526e0 ffff8302453bfc88 (XEN) 0000000000000046 ffff8300a573d000 0000000000000002 ffff8302453f3000 (XEN) ffff8300a29fe000 ffff8302453bfc98 ffff82d080178ad1 ffff8302453bfcf8 (XEN) ffff82d0801659e1 ffff8302453bff18 ffff8302453b8000 efff0002453bfcd8 (XEN) ffff8302453a9000 0000000000000000 0000000000000046 0000000000000082 (XEN) 00000000000000fd 0000005077eb2c26 0000000000000000 ffff8302453bfd10 (XEN) ffff82d080197ced ffff8300a56e3000 ffff8302453bfd60 00000000001526e0 (XEN) ffff8302453bfd50 0000000000000046 ffff83009f7e7020 ffff83024da8b000 (XEN) ffff8300a56e3000 0000000000000000 ffff8302453bfdb0 ffff8300a56e3000 (XEN) ffff8300a573d000 ffff83024da8b000 0000000000000002 ffff8302453f3000 (XEN) ffff8302453bfda0 ffff82d0801d4496 ffff8300a56e3000 ffff8300a573d000 (XEN) ffff8302453bfdc0 ffff82d0801f49ee ffff8302453bfdc0 ffff8300a56e3000 (XEN) ffff8302453bfe20 ffff82d08016a952 0000000000000000 0000000000000000 (XEN) 0000000000000000 0000000000000000 ffff8302453bfe20 ffff8300a573d000 (XEN) 000000507862cc3e ffff8300a56e3000 ffff830247180128 0000000000000001 (XEN) ffff8302453bfeb0 ffff82d08012c50f 92dd987700000002 ffff830247180140 (XEN) 00000002003bfe60 ffff830247180120 ffff8302453bfe60 ffff82d080130034 (XEN) ffff8302453bfeb0 ffff8300a56e3000 0000000001c9c380 ffff82d0801bed01 (XEN) ffff8300a573d000 ffff82d080312b00 ffff82d080312a00 ffffffffffffffff (XEN) Xen call trace: (XEN) [<ffff82d0801dac82>] handle_hvm_io_completion+0x1bb/0x288 (XEN) [<ffff82d0801d4496>] hvm_do_resume+0x35/0x14b (XEN) [<ffff82d0801f49ee>] vmx_do_resume+0x12c/0x143 (XEN) [<ffff82d08016a952>] context_switch+0xf4a/0xf4c (XEN) [<ffff82d08012c50f>] schedule.c#schedule+0x5a5/0x5d7 (XEN) [<ffff82d08012f732>] softirq.c#__do_softirq+0x82/0x8d (XEN) [<ffff82d08012f78a>] do_softirq+0x13/0x15 (XEN) [<ffff82d0801651a5>] domain.c#idle_loop+0x5e/0x6e
(XEN)
(XEN) Pagetable walk from 0000000000000000:
(XEN) L4[0x000] = 0000000000000000 ffffffffffffffff (XEN)
(XEN) **************************************** (XEN) Panic on CPU 2:
(XEN) FATAL PAGE FAULT
(XEN) [error_code=0000]
(XEN) Faulting linear address: 0000000000000000
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 11 lines · Boris Ostrovsky
Quoted 6 lines · Paul Durrant
The code in
hvm/hvm.crelated to handling I/O emulation using the ioreq server framework is large and mostly self-contained.This patch separates the ioreq server code into a new
hvm/ioreq.csource module and accompanyingasm-x86/hvm/ioreq.hheader file. There is no intended functional change, only code movement.This may be more than just code movement. It breaks PVH. I haven't looked at what exactly is breaking but I figured I'd give a heads-up.
Paul and Jan, this needs to be fixed, otherwise we will have to revert this patch (and subsequents patches that depend on this one).
Wei.
Quoted 62 lines
-boris
(XEN) ----[ Xen-4.7-unstable
x86_64debug=y Tainted: C ]----
(XEN) CPU: 2
(XEN) RIP: e008:[<ffff82d0801dac82>]handle_hvm_io_completion+0x1bb/0x288
(XEN) RFLAGS: 0000000000010286 CONTEXT: hypervisor (d1v0)(XEN) rax: ffff8302453b8000 rbx: ffff8300a56e3000 rcx: ffff8302453bffc0 (XEN) rdx: ffff83024da8b000 rsi: ffff82d080326280 rdi: ffff8300a56e3000 (XEN) rbp: ffff8302453bfd80 rsp: ffff8302453bfc20 r8: ffff830247180ed0 (XEN) r9: 00000000ffffff21 r10: 00000000deadbeef r11: 0000000000000246 (XEN) r12: ffff8300a56e3000 r13: 0000000000000000 r14: ffff83024da8b250 (XEN) r15: ffff8302453f3000 cr0: 000000008005003b cr4: 00000000001526e0 (XEN) cr3: 000000024db49000 cr2: 0000000000000000(XEN) ds: 002b es: 002b fs: 0000 gs: 0000 ss: e010 cs: e008
(XEN) Xen code around <ffff82d0801dac82> (handle_hvm_io_completion+0x1bb/0x288):
(XEN) 00 94 fe ff ff 4d 8b 6d <00> 8b 45 00 0f 18 08 4d 39 f5 0f 85 73 fe ff ff
(XEN) Xen stack trace from rsp=ffff8302453bfc20:(XEN) ffff8302453b8000 ffff8302453bfc30 0000000000000000 0000000000000000 (XEN) 0000000000000000 ffff8302453bfc88 00000000001526e0 ffff8302453bfc88 (XEN) 0000000000000046 ffff8300a573d000 0000000000000002 ffff8302453f3000 (XEN) ffff8300a29fe000 ffff8302453bfc98 ffff82d080178ad1 ffff8302453bfcf8 (XEN) ffff82d0801659e1 ffff8302453bff18 ffff8302453b8000 efff0002453bfcd8 (XEN) ffff8302453a9000 0000000000000000 0000000000000046 0000000000000082 (XEN) 00000000000000fd 0000005077eb2c26 0000000000000000 ffff8302453bfd10 (XEN) ffff82d080197ced ffff8300a56e3000 ffff8302453bfd60 00000000001526e0 (XEN) ffff8302453bfd50 0000000000000046 ffff83009f7e7020 ffff83024da8b000 (XEN) ffff8300a56e3000 0000000000000000 ffff8302453bfdb0 ffff8300a56e3000 (XEN) ffff8300a573d000 ffff83024da8b000 0000000000000002 ffff8302453f3000 (XEN) ffff8302453bfda0 ffff82d0801d4496 ffff8300a56e3000 ffff8300a573d000 (XEN) ffff8302453bfdc0 ffff82d0801f49ee ffff8302453bfdc0 ffff8300a56e3000 (XEN) ffff8302453bfe20 ffff82d08016a952 0000000000000000 0000000000000000 (XEN) 0000000000000000 0000000000000000 ffff8302453bfe20 ffff8300a573d000 (XEN) 000000507862cc3e ffff8300a56e3000 ffff830247180128 0000000000000001 (XEN) ffff8302453bfeb0 ffff82d08012c50f 92dd987700000002 ffff830247180140 (XEN) 00000002003bfe60 ffff830247180120 ffff8302453bfe60 ffff82d080130034 (XEN) ffff8302453bfeb0 ffff8300a56e3000 0000000001c9c380 ffff82d0801bed01 (XEN) ffff8300a573d000 ffff82d080312b00 ffff82d080312a00 ffffffffffffffff (XEN) Xen call trace: (XEN) [<ffff82d0801dac82>] handle_hvm_io_completion+0x1bb/0x288 (XEN) [<ffff82d0801d4496>] hvm_do_resume+0x35/0x14b (XEN) [<ffff82d0801f49ee>] vmx_do_resume+0x12c/0x143 (XEN) [<ffff82d08016a952>] context_switch+0xf4a/0xf4c (XEN) [<ffff82d08012c50f>] schedule.c#schedule+0x5a5/0x5d7 (XEN) [<ffff82d08012f732>] softirq.c#__do_softirq+0x82/0x8d (XEN) [<ffff82d08012f78a>] do_softirq+0x13/0x15 (XEN) [<ffff82d0801651a5>] domain.c#idle_loop+0x5e/0x6e(XEN)
(XEN) Pagetable walk from 0000000000000000:
(XEN) L4[0x000] = 0000000000000000 ffffffffffffffff (XEN)
(XEN) **************************************** (XEN) Panic on CPU 2:
(XEN) FATAL PAGE FAULT
(XEN) [error_code=0000]
(XEN) Faulting linear address: 0000000000000000
Quoted 4 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 9 lines · Wei Liu
Quoted 8 lines · Boris Ostrovsky
Quoted 6 lines · Paul Durrant
The code in
hvm/hvm.crelated to handling I/O emulation using the ioreq server framework is large and mostly self-contained.This patch separates the ioreq server code into a new
hvm/ioreq.csource module and accompanyingasm-x86/hvm/ioreq.hheader file. There is no intended functional change, only code movement.
Quoted 7 lines
Quoted 3 lines
This may be more than just code movement. It breaks PVH. I haven't looked at what exactly is breaking but I figured I'd give a heads-up.
Paul and Jan, this needs to be fixed, otherwise we will have to revert this patch (and subsequents patches that depend on this one).
Oops, I guess this is already fixed by Boris ine43b27a5999befcb6948622938253afc4345968b.
Sorry for the noise.
Wei.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel