mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
When dom0 is PVH, and passthrough a device to dumU, xl will use the gsi number of device to do a pirq mapping, see pci_add_dm_done->xc_physdev_map_pirq, but the gsi number is got from file /sys/bus/pci/devices/<sbdf>/irq, that confuses irq and gsi, they are in different space and are not equal, so it will fail when mapping. To solve this issue, to get the real gsi and add a new function xc_physdev_map_pirq_gsi to get a free pirq for gsi. Note: why not use current function xc_physdev_map_pirq, because it doesn't support to allocate a free pirq, what's more, to prevent changing it and affecting its callers, so add xc_physdev_map_pirq_gsi. Besides, PVH dom0 doesn't have PIRQs flag, it doesn't do PHYSDEVOP_map_pirq for each gsi. So grant function callstack pci_add_dm_done->XEN_DOMCTL_irq_permission will fail at function domain_pirq_to_irq. And old hypercall XEN_DOMCTL_irq_permission requires passing in pirq, it is not suitable for PVH dom0 that doesn't have PIRQs to grant irq permission. To solve this issue, use the another hypercall XEN_DOMCTL_gsi_permission to grant the permission of irq( translate from gsi) to dumU when dom0 has no PIRQs. Signed-off-by: Jiqian Chen <Jiqian.Chen@amd.com> Signed-off-by: Huang Rui <ray.huang@amd.com> Signed-off-by: Chen Jiqian <Jiqian.Chen@amd.com> Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
122 lines
4.7 KiB
C
122 lines
4.7 KiB
C
/*
|
|
* Copyright (C) 2012 Citrix Ltd.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU Lesser General Public License as published
|
|
* by the Free Software Foundation; version 2.1 only. with the special
|
|
* exception on linking described in file LICENSE.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU Lesser General Public License for more details.
|
|
*/
|
|
|
|
#ifndef LIBXL_ARCH_H
|
|
#define LIBXL_ARCH_H
|
|
|
|
/* fill the arch specific configuration for the domain */
|
|
_hidden
|
|
int libxl__arch_domain_prepare_config(libxl__gc *gc,
|
|
libxl_domain_config *d_config,
|
|
struct xen_domctl_createdomain *config);
|
|
|
|
/* save the arch specific configuration for the domain */
|
|
_hidden
|
|
int libxl__arch_domain_save_config(libxl__gc *gc,
|
|
libxl_domain_config *d_config,
|
|
libxl__domain_build_state *state,
|
|
const struct xen_domctl_createdomain *config);
|
|
|
|
/* arch specific internal domain creation function */
|
|
_hidden
|
|
int libxl__arch_domain_create(libxl__gc *gc,
|
|
libxl_domain_config *d_config,
|
|
libxl__domain_build_state *state,
|
|
uint32_t domid);
|
|
|
|
/* setup arch specific hardware description, i.e. DTB on ARM */
|
|
_hidden
|
|
int libxl__arch_domain_init_hw_description(libxl__gc *gc,
|
|
libxl_domain_config *d_config,
|
|
libxl__domain_build_state *state,
|
|
struct xc_dom_image *dom);
|
|
/* finalize arch specific hardware description. */
|
|
_hidden
|
|
int libxl__arch_domain_finalise_hw_description(libxl__gc *gc,
|
|
uint32_t domid,
|
|
libxl_domain_config *d_config,
|
|
struct xc_dom_image *dom);
|
|
|
|
/* perform any pending hardware initialization */
|
|
_hidden
|
|
int libxl__arch_build_dom_finish(libxl__gc *gc,
|
|
libxl_domain_build_info *info,
|
|
struct xc_dom_image *dom,
|
|
libxl__domain_build_state *state);
|
|
|
|
/* build vNUMA vmemrange with arch specific information */
|
|
_hidden
|
|
int libxl__arch_vnuma_build_vmemrange(libxl__gc *gc,
|
|
uint32_t domid,
|
|
libxl_domain_build_info *b_info,
|
|
libxl__domain_build_state *state);
|
|
|
|
/* arch specific irq map function */
|
|
_hidden
|
|
int libxl__arch_domain_map_irq(libxl__gc *gc, uint32_t domid, int irq);
|
|
|
|
_hidden
|
|
void libxl__arch_domain_create_info_setdefault(libxl__gc *gc,
|
|
libxl_domain_create_info *c_info);
|
|
|
|
_hidden
|
|
int libxl__arch_domain_build_info_setdefault(libxl__gc *gc,
|
|
libxl_domain_build_info *b_info,
|
|
const libxl_physinfo *physinfo);
|
|
|
|
_hidden
|
|
int libxl__arch_passthrough_mode_setdefault(libxl__gc *gc,
|
|
uint32_t domid /* for logging, only */,
|
|
libxl_domain_config *d_config,
|
|
const libxl_physinfo *physinfo);
|
|
|
|
_hidden
|
|
int libxl__arch_extra_memory(libxl__gc *gc,
|
|
const libxl_domain_build_info *info,
|
|
uint64_t *out);
|
|
|
|
_hidden
|
|
void libxl__arch_update_domain_config(libxl__gc *gc,
|
|
libxl_domain_config *dst,
|
|
const libxl_domain_config *src);
|
|
|
|
_hidden
|
|
int libxl__arch_hvm_map_gsi(libxl__gc *gc, uint32_t sbdf, uint32_t domid);
|
|
_hidden
|
|
int libxl__arch_hvm_unmap_gsi(libxl__gc *gc, uint32_t sbdf, uint32_t domid);
|
|
_hidden
|
|
bool libxl__arch_local_domain_has_pirq_notion(libxl__gc *gc);
|
|
#if defined(__i386__) || defined(__x86_64__)
|
|
|
|
#define LAPIC_BASE_ADDRESS 0xfee00000
|
|
#define ACPI_INFO_PHYSICAL_ADDRESS 0xfc000000
|
|
#define EXTRA_DEFAULT_PAGING_MEM_MB 0
|
|
|
|
int libxl__dom_load_acpi(libxl__gc *gc,
|
|
const libxl_domain_build_info *b_info,
|
|
struct xc_dom_image *dom);
|
|
|
|
#else
|
|
|
|
/*
|
|
* 128MB extra default paging memory on Arm for extended regions. This
|
|
* value is normally enough for domains that are not running backend.
|
|
* See the `shadow_memory` in xl.cfg documentation for more information.
|
|
*/
|
|
#define EXTRA_DEFAULT_PAGING_MEM_MB 128
|
|
|
|
#endif
|
|
|
|
#endif
|