[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [QEMU][PATCH v4 04/10] xen-hvm: reorganize xen-hvm and move common function to xen-hvm-common


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • From: Vikram Garhwal <vikram.garhwal@xxxxxxx>
  • Date: Wed, 25 Jan 2023 14:38:47 -0800
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1RU7lzqCpBB1280QOXUVIR+DSuSw8vtfdFZGSytrw4Y=; b=mPihZU5KU3871/Pmd1cY7z4ST77wHrPtYOIw5x8KKloo0PdfjqcTjR1x2awLaSkVBusukfTKHL6h6OXeumGaij6PmO1Ne2eBxlP5DcrYIb2YS111l82edUB9ouoL1xOaTfEMcsjVDreXunPqSpf744IzqI5ULU4gmBiyUbRy0vl9mAeTi6SHfAP3ZcvQ3Mk75pd1BPRt7S1Vpfoapq7x/AExF2jXdoAp4z2vJAWHszPHIToI+jG7sWgPn00MfRbabCUPSYbbarpfmz0CY5gnwnY1yZp4OtaagO1gqfQ9AHErvEQ8EaSTOykEOVIKTeZr6/+wUv0CdmuUQmWrw1n5mA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ji8EGikVIjrqdqnOkXJJBbDgd8FQzTYmzS3DNT/ehmpEUfVaddrSJMsYA/EH7KoMml+dyylCsdl330MlG8VMEKebWbOWn7dokA2UK6afPHDYOBIfoSb8YhI6QY8RKX3kVSm5q2NmleiwG/YO+zU+3YJk/sSzs+RbCx2xgMiAgoV56dQ8jnt4rjY3cy1rHXVGNJn59x+zl/rL/3myxKUbMESkcwPOCMMn8ODyl6/WhfGgkfkv4RyvglJTUxpH1cnZfcchQxX3P0mI/Dll7wOeOEyuttMic60uRweKY4vHhhUfSpZaKhJCArSSP8bTcgCJg6Ad+Oz3Oq2DYpJfif2UJw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • Cc: qemu-devel@xxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx, stefano.stabellini@xxxxxxx, alex.bennee@xxxxxxxxxx, Anthony Perard <anthony.perard@xxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, Paolo Bonzini <pbonzini@xxxxxxxxxx>, Richard Henderson <richard.henderson@xxxxxxxxxx>, Eduardo Habkost <eduardo@xxxxxxxxxxx>, "Michael S. Tsirkin" <mst@xxxxxxxxxx>, Marcel Apfelbaum <marcel.apfelbaum@xxxxxxxxx>
  • Delivery-date: Wed, 25 Jan 2023 22:39:12 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hi Stefano,

On 1/25/23 1:55 PM, Stefano Stabellini wrote:
On Wed, 25 Jan 2023, Vikram Garhwal wrote:
From: Stefano Stabellini <stefano.stabellini@xxxxxxx>

This patch does following:
1. creates arch_handle_ioreq() and arch_xen_set_memory(). This is done in
     preparation for moving most of xen-hvm code to an arch-neutral location,
     move the x86-specific portion of xen_set_memory to arch_xen_set_memory.
     Also, move handle_vmport_ioreq to arch_handle_ioreq.

2. Pure code movement: move common functions to hw/xen/xen-hvm-common.c
     Extract common functionalities from hw/i386/xen/xen-hvm.c and move them to
     hw/xen/xen-hvm-common.c. These common functions are useful for creating
     an IOREQ server.

     xen_hvm_init_pc() contains the architecture independent code for creating
     and mapping a IOREQ server, connecting memory and IO listeners, 
initializing
     a xen bus and registering backends. Moved this common xen code to a new
     function xen_register_ioreq() which can be used by both x86 and ARM 
machines.

     Following functions are moved to hw/xen/xen-hvm-common.c:
         xen_vcpu_eport(), xen_vcpu_ioreq(), xen_ram_alloc(), xen_set_memory(),
         xen_region_add(), xen_region_del(), xen_io_add(), xen_io_del(),
         xen_device_realize(), xen_device_unrealize(),
         cpu_get_ioreq_from_shared_memory(), cpu_get_ioreq(), do_inp(),
         do_outp(), rw_phys_req_item(), read_phys_req_item(),
         write_phys_req_item(), cpu_ioreq_pio(), cpu_ioreq_move(),
         cpu_ioreq_config(), handle_ioreq(), handle_buffered_iopage(),
         handle_buffered_io(), cpu_handle_ioreq(), xen_main_loop_prepare(),
         xen_hvm_change_state_handler(), xen_exit_notifier(),
         xen_map_ioreq_server(), destroy_hvm_domain() and
         xen_shutdown_fatal_error()

3. Removed static type from below functions:
     1. xen_region_add()
     2. xen_region_del()
     3. xen_io_add()
     4. xen_io_del()
     5. xen_device_realize()
     6. xen_device_unrealize()
     7. xen_hvm_change_state_handler()
     8. cpu_ioreq_pio()
     9. xen_exit_notifier()

4. Replace TARGET_PAGE_SIZE with XC_PAGE_SIZE to match the page side with Xen.

Signed-off-by: Vikram Garhwal <vikram.garhwal@xxxxxxx>
Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxx>
One comment below

[...]

+void xen_exit_notifier(Notifier *n, void *data)
+{
+    XenIOState *state = container_of(n, XenIOState, exit);
+
+    xen_destroy_ioreq_server(xen_domid, state->ioservid);
In the original code we had:

-    if (state->fres != NULL) {
-        xenforeignmemory_unmap_resource(xen_fmem, state->fres);
-    }

Should we add it here?


I went through the manual process of comparing all the code additions
and deletions (not fun!) and everything checks out except for this.
thanks for catching this. There were two recent commits in upstream and i missed those. I rechecked and there are actually three other lines which needs update. I will address it in v5.

+    xenevtchn_close(state->xce_handle);
+    xs_daemon_close(state->xenstore);
+}



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.