|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v8 2/3] Differentiate IO/mem resources tracked by ioreq server
>>> On 23.08.15 at 11:33, <yu.c.zhang@xxxxxxxxxxxxxxx> wrote:
> --- a/xen/arch/x86/hvm/hvm.c
> +++ b/xen/arch/x86/hvm/hvm.c
> @@ -938,8 +938,9 @@ static int hvm_ioreq_server_alloc_rangesets(struct
> hvm_ioreq_server *s,
>
> rc = asprintf(&name, "ioreq_server %d %s", s->id,
> (i == HVMOP_IO_RANGE_PORT) ? "port" :
> - (i == HVMOP_IO_RANGE_MEMORY) ? "memory" :
> + (i == HVMOP_IO_RANGE_MEMORY) ? "mmio" :
> (i == HVMOP_IO_RANGE_PCI) ? "pci" :
> + (i == HVMOP_IO_RANGE_WP_MEM) ? "wp-ed memory" :
> "");
This is becoming unwieldy - please use a static array to get at the
strings.
> @@ -2566,6 +2571,17 @@ struct hvm_ioreq_server
> *hvm_select_ioreq_server(struct domain *d,
> type = (p->type == IOREQ_TYPE_PIO) ?
> HVMOP_IO_RANGE_PORT : HVMOP_IO_RANGE_MEMORY;
> addr = p->addr;
> +
> + if ( type == HVMOP_IO_RANGE_MEMORY )
> + {
> + ram_page = get_page_from_gfn(d, p->addr >> PAGE_SHIFT,
> + &p2mt, P2M_UNSHARE);
> + if ( p2mt == p2m_mmio_write_dm )
> + type = HVMOP_IO_RANGE_WP_MEM;
> +
> + if ( ram_page )
> + put_page(ram_page);
> + }
I doubt you really want to alter the type when !ram_page. Plus
this altering of the type - if really needed / intended - should be
explained in a comment (after all you have an explicit type for the
caller to pass).
> @@ -2607,6 +2623,11 @@ struct hvm_ioreq_server
> *hvm_select_ioreq_server(struct domain *d,
> }
>
> break;
> + case HVMOP_IO_RANGE_WP_MEM:
> + if ( rangeset_contains_singleton(r, addr >> PAGE_SHIFT) )
PFN_DOWN() or paddr_to_pfn() please.
> --- a/xen/include/asm-x86/hvm/domain.h
> +++ b/xen/include/asm-x86/hvm/domain.h
> @@ -48,8 +48,8 @@ struct hvm_ioreq_vcpu {
> bool_t pending;
> };
>
> -#define NR_IO_RANGE_TYPES (HVMOP_IO_RANGE_PCI + 1)
> -#define MAX_NR_IO_RANGES 256
> +#define NR_IO_RANGE_TYPES (HVMOP_IO_RANGE_WP_MEM + 1)
> +#define MAX_NR_IO_RANGES 8192
If you want this to be done in this patch, then this and patch 3
need to change their order.
> --- a/xen/include/public/hvm/hvm_op.h
> +++ b/xen/include/public/hvm/hvm_op.h
> @@ -331,6 +331,7 @@ struct xen_hvm_io_range {
> # define HVMOP_IO_RANGE_PORT 0 /* I/O port range */
> # define HVMOP_IO_RANGE_MEMORY 1 /* MMIO range */
> # define HVMOP_IO_RANGE_PCI 2 /* PCI segment/bus/dev/func range */
> +# define HVMOP_IO_RANGE_WP_MEM 3 /* Write-protected memory range */
"memory" is too vague, considering that you mean RAM here and
"MEMORY" above stands for MMIO.
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |